<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="common/css/sf.css" rel="stylesheet" type="text/css" />
<title>PE: Partial Evaluation</title>
<link href="common/jquery-ui/jquery-ui.css" rel="stylesheet">
<script src="common/jquery-ui/external/jquery/jquery.js"></script>
<script src="common/jquery-ui/jquery-ui.js"></script>
<script src="common/toggleproofs.js"></script>
<link href="common/css/plf.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<div id="page">

<div id="header">
<div id='logoinheader'><a href='https://softwarefoundations.cis.upenn.edu'>
<img src='common/media/image/sf_logo_sm.png' alt='Software Foundations Logo'></a></div>
<div class='booktitleinheader'><a href='index.html'>Volume 2: Programming Language Foundations</a></div>
<ul id='menu'>
   <li class='section_name'><a href='toc.html'>Table of Contents</a></li>
   <li class='section_name'><a href='coqindex.html'>Index</a></li>
   <li class='section_name'><a href='deps.html'>Roadmap</a></li>
</ul>
</div>

<div id="main">

<h1 class="libtitle">PE<span class="subtitle">Partial Evaluation</span></h1>


<div class="code">

<span class="comment">(*&nbsp;Chapter&nbsp;written&nbsp;and&nbsp;maintained&nbsp;by&nbsp;Chung-chieh&nbsp;Shan&nbsp;*)</span><br/>
</div>

<div class="doc">
The <a href="Equiv.html"><span class="inlineref">Equiv</span></a> chapter introduced constant folding as an example of a
    program transformation and proved that it preserves the meaning of
    programs.  Constant folding operates on manifest constants such as
    <span class="inlinecode"><span class="id" title="var">ANum</span></span> expressions.  For example, it simplifies the command <span class="inlinecode"><span class="id" title="var">Y</span></span> <span class="inlinecode">:=</span>
    <span class="inlinecode">3</span> <span class="inlinecode">+</span> <span class="inlinecode">1</span> to the command <span class="inlinecode"><span class="id" title="var">Y</span></span> <span class="inlinecode">:=</span> <span class="inlinecode">4</span>.  However,
    it does not propagate known constants along data flow.  For
    example, it does not simplify the sequence
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3; <span class="id" title="var">Y</span> := <span class="id" title="var">X</span> + 1
</span>    to
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3; <span class="id" title="var">Y</span> := 4
</span>    because it forgets that <span class="inlinecode"><span class="id" title="var">X</span></span> is <span class="inlinecode">3</span> by the time it gets to <span class="inlinecode"><span class="id" title="var">Y</span></span>.

<div class="paragraph"> </div>

    We might naturally want to enhance constant folding so that it
    propagates known constants and uses them to simplify programs.
    Doing so constitutes a rudimentary form of <i>partial evaluation</i>.
    As we will see, partial evaluation is so called because it is like
    running a program, except only part of the program can be
    evaluated because only part of the input to the program is known.
    For example, we can only simplify the program
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3; <span class="id" title="var">Y</span> := (<span class="id" title="var">X</span> + 1) - <span class="id" title="var">Y</span>
</span>    to
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3; <span class="id" title="var">Y</span> := 4 - <span class="id" title="var">Y</span>
</span>    without knowing the initial value of <span class="inlinecode"><span class="id" title="var">Y</span></span>. 
</div>
<div class="code">

<span class="id" title="keyword">From</span> <span class="id" title="var">PLF</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <span class="id" title="library">Maps</span>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Bool.Bool.html#"><span class="id" title="library">Bool.Bool</span></a>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.Arith.html#"><span class="id" title="library">Arith.Arith</span></a>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.EqNat.html#"><span class="id" title="library">Arith.EqNat</span></a>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.PeanoNat.html#"><span class="id" title="library">Arith.PeanoNat</span></a>. <span class="id" title="keyword">Import</span> <span class="id" title="var">Nat</span>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.micromega.Lia.html#"><span class="id" title="library">Lia</span></a>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#"><span class="id" title="library">Logic.FunctionalExtensionality</span></a>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">Coq</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#"><span class="id" title="library">Lists.List</span></a>.<br/>
<span class="id" title="keyword">Import</span> <span class="id" title="var">ListNotations</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">From</span> <span class="id" title="var">PLF</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="Smallstep.html#"><span class="id" title="library">Smallstep</span></a>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">PLF</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <span class="id" title="library">Imp</span>.<br/>
</div>

<div class="doc">
<a id="lab475"></a><h1 class="section">Generalizing Constant Folding</h1>

<div class="paragraph"> </div>

 The starting point of partial evaluation is to represent our
    partial knowledge about the state.  For example, between the two
    assignments above, the partial evaluator may know only that <span class="inlinecode"><span class="id" title="var">X</span></span> is
    <span class="inlinecode">3</span> and nothing about any other variable. 
<div class="paragraph"> </div>

<a id="lab476"></a><h2 class="section">Partial States</h2>

<div class="paragraph"> </div>

 Conceptually speaking, we can think of such partial states as the
    type <span class="inlinecode"><span class="id" title="var">string</span></span> <span class="inlinecode">→</span> <span class="inlinecode"><span class="id" title="var">option</span></span> <span class="inlinecode"><span class="id" title="var">nat</span></span> (as opposed to the type <span class="inlinecode"><span class="id" title="var">string</span></span> <span class="inlinecode">→</span> <span class="inlinecode"><span class="id" title="var">nat</span></span> of
    concrete, full states).  However, in addition to looking up and
    updating the values of individual variables in a partial state, we
    may also want to compare two partial states to see if and where
    they differ, to handle conditional control flow.  It is not possible
    to compare two arbitrary functions in this way, so we represent
    partial states in a more concrete format: as a list of <span class="inlinecode"><span class="id" title="var">string</span></span> <span class="inlinecode">×</span> <span class="inlinecode"><span class="id" title="var">nat</span></span>
    pairs. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="pe_state" class="idref" href="#pe_state"><span class="id" title="definition">pe_state</span></a> := <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> (<a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#11c698c8685bb8ab1cf725545c085ac<sub>4</sub>"><span class="id" title="notation">×</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>).<br/>
</div>

<div class="doc">
The idea is that a variable (of type <span class="inlinecode"><span class="id" title="var">string</span></span>) appears in the list if and only
    if we know its current <span class="inlinecode"><span class="id" title="var">nat</span></span> value.  The <span class="inlinecode"><span class="id" title="var">pe_lookup</span></span> function thus
    interprets this concrete representation.  (If the same variable
    appears multiple times in the list, the first occurrence
    wins, but we will define our partial evaluator to never construct
    such a <span class="inlinecode"><span class="id" title="var">pe_state</span></span>.) 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_lookup" class="idref" href="#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> (<a id="pe_st:1" class="idref" href="#pe_st:1"><span class="id" title="binder">pe_st</span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="V:2" class="idref" href="#V:2"><span class="id" title="binder">V</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#option"><span class="id" title="inductive">option</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_st:1"><span class="id" title="variable">pe_st</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">V'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a><span class="id" title="var">n'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">pe_st</span> ⇒ <span class="id" title="keyword">if</span> <span class="id" title="definition">eqb_string</span> <a class="idref" href="PE.html#V:2"><span class="id" title="variable">V</span></a> <span class="id" title="var">V'</span> <span class="id" title="keyword">then</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">n'</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">else</span> <a class="idref" href="PE.html#pe_lookup:3"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:1"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:2"><span class="id" title="variable">V</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
</div>

<div class="doc">
For example, <span class="inlinecode"><span class="id" title="var">empty_pe_state</span></span> represents complete ignorance about
    every variable -- the function that maps every identifier to <span class="inlinecode"><span class="id" title="var">None</span></span>. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="empty_pe_state" class="idref" href="#empty_pe_state"><span class="id" title="definition">empty_pe_state</span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> := <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a>.<br/>
</div>

<div class="doc">
More generally, if the <span class="inlinecode"><span class="id" title="var">list</span></span> representing a <span class="inlinecode"><span class="id" title="var">pe_state</span></span> does not
    contain some identifier, then that <span class="inlinecode"><span class="id" title="var">pe_state</span></span> must map that identifier to
    <span class="inlinecode"><span class="id" title="var">None</span></span>.  Before we prove this fact, we first define a useful
    tactic for reasoning with <span class="inlinecode"><span class="id" title="var">string</span></span> equality.  The tactic
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">compare</span> <span class="id" title="var">V</span> <span class="id" title="var">V'</span>
</span>    means to reason by cases over <span class="inlinecode"><span class="id" title="var">eqb_string</span></span> <span class="inlinecode"><span class="id" title="var">V</span></span> <span class="inlinecode"><span class="id" title="var">V'</span></span>.
    In the case where <span class="inlinecode"><span class="id" title="var">V</span></span> <span class="inlinecode">=</span> <span class="inlinecode"><span class="id" title="var">V'</span></span>, the tactic
    substitutes <span class="inlinecode"><span class="id" title="var">V</span></span> for <span class="inlinecode"><span class="id" title="var">V'</span></span> throughout. 
</div>
<div class="code">

<span class="id" title="keyword">Tactic Notation</span> "compare" <span class="id" title="var">ident</span>(<span class="id" title="var">i</span>) <span class="id" title="var">ident</span>(<span class="id" title="var">j</span>) :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">let</span> <span class="id" title="var">H</span> := <span class="id" title="tactic">fresh</span> "Heq" <span class="id" title="var">i</span> <span class="id" title="var">j</span> <span class="id" title="keyword">in</span><br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<span class="id" title="axiom">eqb_stringP</span> <span class="id" title="var">i</span> <span class="id" title="var">j</span>);<br/>
&nbsp;&nbsp;[ <span class="id" title="tactic">subst</span> <span class="id" title="var">j</span> | ].<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_domain" class="idref" href="#pe_domain"><span class="id" title="lemma">pe_domain</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st:5" class="idref" href="#pe_st:5"><span class="id" title="binder">pe_st</span></a> <a id="V:6" class="idref" href="#V:6"><span class="id" title="binder">V</span></a> <a id="n:7" class="idref" href="#n:7"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:5"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:6"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <a class="idref" href="PE.html#n:7"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a> <a class="idref" href="PE.html#V:6"><span class="id" title="variable">V</span></a> (<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#map"><span class="id" title="definition">map</span></a> (@<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#fst"><span class="id" title="definition">fst</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span>) <a class="idref" href="PE.html#pe_st:5"><span class="id" title="variable">pe_st</span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span> <span class="id" title="var">n</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">pe_st</span> <span class="id" title="keyword">as</span> [| [<span class="id" title="var">V'</span> <span class="id" title="var">n'</span>] <span class="id" title="var">pe_st</span>].<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="inlinecode"></span>&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;::&nbsp;*)</span> <span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">simpl</span>. <span class="id" title="var">compare</span> <span class="id" title="var">V</span> <span class="id" title="var">V'</span>; <span class="id" title="tactic">auto</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
In what follows, we will make heavy use of the <span class="inlinecode"><span class="id" title="var">In</span></span> property from
    the standard library, also defined in <span class="inlinecode"><span class="id" title="var">Logic.v</span></span>: 
</div>
<div class="code">

<span class="id" title="keyword">Print</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a>.<br/>
<span class="comment">(*&nbsp;===&gt;&nbsp;Fixpoint&nbsp;In&nbsp;{A:Type}&nbsp;(a:&nbsp;A)&nbsp;(l:list&nbsp;A)&nbsp;:&nbsp;Prop&nbsp;:=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;match&nbsp;l&nbsp;with<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;<span class="inlinecode"></span>&nbsp;=&gt;&nbsp;False<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;b&nbsp;::&nbsp;m&nbsp;=&gt;&nbsp;b&nbsp;=&nbsp;a&nbsp;\/&nbsp;In&nbsp;a&nbsp;m<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;forall&nbsp;A&nbsp;:&nbsp;Type,&nbsp;A&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;list&nbsp;A&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;Prop&nbsp;*)</span><br/>
</div>

<div class="doc">
Besides the various lemmas about <span class="inlinecode"><span class="id" title="var">In</span></span> that we've already come
    across, the following one (taken from the standard library) will
    also be useful: 
</div>
<div class="code">

<span class="id" title="keyword">Check</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#filter_In"><span class="id" title="lemma">filter_In</span></a>.<br/>
<span class="comment">(*&nbsp;===&gt;&nbsp;filter_In&nbsp;:&nbsp;forall&nbsp;(A&nbsp;:&nbsp;Type)&nbsp;(f&nbsp;:&nbsp;A&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;bool)&nbsp;(x&nbsp;:&nbsp;A)&nbsp;(l&nbsp;:&nbsp;list&nbsp;A),<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In&nbsp;x&nbsp;(filter&nbsp;f&nbsp;l)&nbsp;&lt;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;In&nbsp;x&nbsp;l&nbsp;/\&nbsp;f&nbsp;x&nbsp;=&nbsp;true&nbsp;&nbsp;*)</span><br/>
</div>

<div class="doc">
If a type <span class="inlinecode"><span class="id" title="var">A</span></span> has an operator <span class="inlinecode"><span class="id" title="var">eqb</span></span> for testing equality of its
    elements, we can compute a boolean <span class="inlinecode"><span class="id" title="var">inb</span></span> <span class="inlinecode"><span class="id" title="var">eqb</span></span> <span class="inlinecode"><span class="id" title="var">a</span></span> <span class="inlinecode"><span class="id" title="var">l</span></span> for testing
    whether <span class="inlinecode"><span class="id" title="var">In</span></span> <span class="inlinecode"><span class="id" title="var">a</span></span> <span class="inlinecode"><span class="id" title="var">l</span></span> holds or not. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="inb" class="idref" href="#inb"><span class="id" title="definition">inb</span></a> {<a id="A:8" class="idref" href="#A:8"><span class="id" title="binder">A</span></a> : <span class="id" title="keyword">Type</span>} (<a id="eqb:9" class="idref" href="#eqb:9"><span class="id" title="binder">eqb</span></a> : <a class="idref" href="PE.html#A:8"><span class="id" title="variable">A</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#A:8"><span class="id" title="variable">A</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a>) (<a id="a:10" class="idref" href="#a:10"><span class="id" title="binder">a</span></a> : <a class="idref" href="PE.html#A:8"><span class="id" title="variable">A</span></a>) (<a id="l:11" class="idref" href="#l:11"><span class="id" title="binder">l</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="PE.html#A:8"><span class="id" title="variable">A</span></a>) :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#l:11"><span class="id" title="variable">l</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <span class="id" title="notation">false</span><br/>
&nbsp;&nbsp;| <span class="id" title="var">a'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">l'</span> ⇒ <a class="idref" href="PE.html#eqb:9"><span class="id" title="variable">eqb</span></a> <a class="idref" href="PE.html#a:10"><span class="id" title="variable">a</span></a> <span class="id" title="var">a'</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#081ff67d3116402bb680e8692aa39185"><span class="id" title="notation">||</span></a> <a class="idref" href="PE.html#inb:12"><span class="id" title="definition">inb</span></a> <a class="idref" href="PE.html#eqb:9"><span class="id" title="variable">eqb</span></a> <a class="idref" href="PE.html#a:10"><span class="id" title="variable">a</span></a> <span class="id" title="var">l'</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
</div>

<div class="doc">
It is easy to relate <span class="inlinecode"><span class="id" title="var">inb</span></span> to <span class="inlinecode"><span class="id" title="var">In</span></span> with the <span class="inlinecode"><span class="id" title="var">reflect</span></span> property: 
</div>
<div class="code">

<span class="id" title="keyword">Lemma</span> <a id="inbP" class="idref" href="#inbP"><span class="id" title="lemma">inbP</span></a> : <span class="id" title="keyword">∀</span> <a id="A:14" class="idref" href="#A:14"><span class="id" title="binder">A</span></a> : <span class="id" title="keyword">Type</span>, <span class="id" title="keyword">∀</span> <a id="eqb:15" class="idref" href="#eqb:15"><span class="id" title="binder">eqb</span></a> : <a class="idref" href="PE.html#A:14"><span class="id" title="variable">A</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><a class="idref" href="PE.html#A:14"><span class="id" title="variable">A</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><span class="id" title="keyword">∀</span> <a id="a<sub>1</sub>:16" class="idref" href="#a<sub>1</sub>:16"><span class="id" title="binder">a<sub>1</sub></span></a> <a id="a<sub>2</sub>:17" class="idref" href="#a<sub>2</sub>:17"><span class="id" title="binder">a<sub>2</sub></span></a>, <a class="idref" href="http://coq.inria.fr/library//Coq.Bool.Bool.html#reflect"><span class="id" title="inductive">reflect</span></a> (<a class="idref" href="PE.html#a<sub>1</sub>:16"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#a<sub>2</sub>:17"><span class="id" title="variable">a<sub>2</sub></span></a>) (<a class="idref" href="PE.html#eqb:15"><span class="id" title="variable">eqb</span></a> <a class="idref" href="PE.html#a<sub>1</sub>:16"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="PE.html#a<sub>2</sub>:17"><span class="id" title="variable">a<sub>2</sub></span></a>)<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="a:18" class="idref" href="#a:18"><span class="id" title="binder">a</span></a> <a id="l:19" class="idref" href="#l:19"><span class="id" title="binder">l</span></a>, <a class="idref" href="http://coq.inria.fr/library//Coq.Bool.Bool.html#reflect"><span class="id" title="inductive">reflect</span></a> (<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a> <a class="idref" href="PE.html#a:18"><span class="id" title="variable">a</span></a> <a class="idref" href="PE.html#l:19"><span class="id" title="variable">l</span></a>) (<a class="idref" href="PE.html#inb"><span class="id" title="definition">inb</span></a> <a class="idref" href="PE.html#eqb:15"><span class="id" title="variable">eqb</span></a> <a class="idref" href="PE.html#a:18"><span class="id" title="variable">a</span></a> <a class="idref" href="PE.html#l:19"><span class="id" title="variable">l</span></a>).<br/>
<span class="id" title="keyword">Proof</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">A</span> <span class="id" title="var">eqb</span> <span class="id" title="var">beqP</span> <span class="id" title="var">a</span> <span class="id" title="var">l</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">l</span> <span class="id" title="keyword">as</span> [|<span class="id" title="var">a'</span> <span class="id" title="var">l'</span> <span class="id" title="var">IH</span>].<br/>
&nbsp;&nbsp;- <span class="id" title="tactic">constructor</span>. <span class="id" title="tactic">intros</span> [].<br/>
&nbsp;&nbsp;- <span class="id" title="tactic">simpl</span>. <span class="id" title="tactic">destruct</span> (<span class="id" title="var">beqP</span> <span class="id" title="var">a</span> <span class="id" title="var">a'</span>).<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="id" title="tactic">subst</span>. <span class="id" title="tactic">constructor</span>. <span class="id" title="tactic">left</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="id" title="tactic">simpl</span>. <span class="id" title="tactic">destruct</span> <span class="id" title="var">IH</span>; <span class="id" title="tactic">constructor</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="id" title="tactic">right</span>. <span class="id" title="tactic">trivial</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="id" title="tactic">intros</span> [<span class="id" title="var">H<sub>1</sub></span> | <span class="id" title="var">H<sub>2</sub></span>]; <span class="id" title="tactic">congruence</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab477"></a><h2 class="section">Arithmetic Expressions</h2>

<div class="paragraph"> </div>

 Partial evaluation of <span class="inlinecode"><span class="id" title="var">aexp</span></span> is straightforward -- it is basically
    the same as constant folding, <span class="inlinecode"><span class="id" title="var">fold_constants_aexp</span></span>, except that
    sometimes the partial state tells us the current value of a
    variable and we can replace it by a constant expression. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_aexp" class="idref" href="#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> (<a id="pe_st:20" class="idref" href="#pe_st:20"><span class="id" title="binder">pe_st</span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="a:21" class="idref" href="#a:21"><span class="id" title="binder">a</span></a> : <span class="id" title="inductive">aexp</span>) : <span class="id" title="inductive">aexp</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#a:21"><span class="id" title="variable">a</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <span class="id" title="constructor">ANum</span> <span class="id" title="var">n</span> ⇒ <span class="id" title="constructor">ANum</span> <span class="id" title="var">n</span><br/>
&nbsp;&nbsp;| <span class="id" title="constructor">AId</span> <span class="id" title="var">i</span> ⇒ <span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">i</span> <span class="id" title="keyword">with</span> <span class="comment">(*&nbsp;&lt;-----&nbsp;NEW&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">n</span> ⇒ <span class="id" title="constructor">ANum</span> <span class="id" title="var">n</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> ⇒ <span class="id" title="constructor">AId</span> <span class="id" title="var">i</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub></span> <span class="id" title="notation">+</span> <span class="id" title="var">a<sub>2</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_aexp:22"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#pe_aexp:22"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="constructor">ANum</span> (<span class="id" title="var">n<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#0dacc1786c5ba797d47dd85006231633"><span class="id" title="notation">+</span></a> <span class="id" title="var">n<sub>2</sub></span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">a<sub>1</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">a<sub>2</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub>'</span> <span class="id" title="notation">+</span> <span class="id" title="var">a<sub>2</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub></span> <span class="id" title="notation">-</span> <span class="id" title="var">a<sub>2</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_aexp:22"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#pe_aexp:22"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="constructor">ANum</span> (<span class="id" title="var">n<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#::nat_scope:x_'-'_x"><span class="id" title="notation">-</span></a> <span class="id" title="var">n<sub>2</sub></span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">a<sub>1</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">a<sub>2</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub>'</span> <span class="id" title="notation">-</span> <span class="id" title="var">a<sub>2</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub></span> <span class="id" title="notation">×</span> <span class="id" title="var">a<sub>2</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_aexp:22"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#pe_aexp:22"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:20"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="constructor">ANum</span> (<span class="id" title="var">n<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#ea2ff3d561159081cea6fb2e8113cc<sub>54</sub>"><span class="id" title="notation">×</span></a> <span class="id" title="var">n<sub>2</sub></span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">a<sub>1</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">a<sub>2</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub>'</span> <span class="id" title="notation">×</span> <span class="id" title="var">a<sub>2</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
</div>

<div class="doc">
This partial evaluator folds constants but does not apply the
    associativity of addition. 
</div>
<div class="code">

<span class="id" title="keyword">Example</span> <a id="test_pe_aexp1" class="idref" href="#test_pe_aexp1"><span class="id" title="definition">test_pe_aexp1</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>3<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">+</span> 1 <span class="id" title="notation">+</span> <span class="id" title="definition">Y</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span>4 <span class="id" title="notation">+</span> <span class="id" title="definition">Y</span><span class="id" title="notation">}&gt;</span>.<br/>
<div class="togglescript" id="proofcontrol1" onclick="toggleDisplay('proof1');toggleDisplay('proofcontrol1')"><span class="show"></span></div>
<div class="proofscript" id="proof1" onclick="toggleDisplay('proof1');toggleDisplay('proofcontrol1')">
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<br/>
<span class="id" title="keyword">Example</span> <a id="text_pe_aexp2" class="idref" href="#text_pe_aexp2"><span class="id" title="definition">text_pe_aexp2</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">Y</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>3<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">+</span> 1 <span class="id" title="notation">+</span> <span class="id" title="definition">Y</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">+</span> 1 <span class="id" title="notation">+</span> 3<span class="id" title="notation">}&gt;</span>.<br/>
<div class="togglescript" id="proofcontrol2" onclick="toggleDisplay('proof2');toggleDisplay('proofcontrol2')"><span class="show"></span></div>
<div class="proofscript" id="proof2" onclick="toggleDisplay('proof2');toggleDisplay('proofcontrol2')">
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>
</div>

<div class="doc">
Now, in what sense is <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span> correct?  It is reasonable to
    define the correctness of <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span> as follows: whenever a full
    state <span class="inlinecode"><span class="id" title="var">st</span>:<span class="id" title="var">state</span></span> is <i>consistent</i> with a partial state
    <span class="inlinecode"><span class="id" title="var">pe_st</span>:<span class="id" title="var">pe_state</span></span> (in other words, every variable to which <span class="inlinecode"><span class="id" title="var">pe_st</span></span>
    assigns a value is assigned the same value by <span class="inlinecode"><span class="id" title="var">st</span></span>), evaluating
    <span class="inlinecode"><span class="id" title="var">a</span></span> and evaluating <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span> <span class="inlinecode"><span class="id" title="var">pe_st</span></span> <span class="inlinecode"><span class="id" title="var">a</span></span> in <span class="inlinecode"><span class="id" title="var">st</span></span> yields the same
    result.  This statement is indeed true. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="pe_consistent" class="idref" href="#pe_consistent"><span class="id" title="definition">pe_consistent</span></a> (<a id="st:24" class="idref" href="#st:24"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) (<a id="pe_st:25" class="idref" href="#pe_st:25"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="V:26" class="idref" href="#V:26"><span class="id" title="binder">V</span></a> <a id="n:27" class="idref" href="#n:27"><span class="id" title="binder">n</span></a>, <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <a class="idref" href="PE.html#n:27"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:25"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:26"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#st:24"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#V:26"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#n:27"><span class="id" title="variable">n</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_aexp_correct_weak" class="idref" href="#pe_aexp_correct_weak"><span class="id" title="lemma">pe_aexp_correct_weak</span></a>: <span class="id" title="keyword">∀</span> <a id="st:28" class="idref" href="#st:28"><span class="id" title="binder">st</span></a> <a id="pe_st:29" class="idref" href="#pe_st:29"><span class="id" title="binder">pe_st</span></a>, <a class="idref" href="PE.html#pe_consistent"><span class="id" title="definition">pe_consistent</span></a> <a class="idref" href="PE.html#st:28"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:29"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="a:30" class="idref" href="#a:30"><span class="id" title="binder">a</span></a>, <span class="id" title="definition">aeval</span> <a class="idref" href="PE.html#st:28"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#a:30"><span class="id" title="variable">a</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">aeval</span> <a class="idref" href="PE.html#st:28"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:29"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#a:30"><span class="id" title="variable">a</span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#pe_consistent"><span class="id" title="definition">pe_consistent</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">H</span> <span class="id" title="var">a</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">a</span>; <span class="id" title="tactic">simpl</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">reflexivity</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a<sub>1</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a<sub>2</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHa1</span>; <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHa2</span>; <span class="id" title="tactic">reflexivity</span>).<br/>
&nbsp;&nbsp;<span class="comment">(*&nbsp;Compared&nbsp;to&nbsp;fold_constants_aexp_sound,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;only&nbsp;interesting&nbsp;case&nbsp;is&nbsp;AId&nbsp;*)</span><br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;AId&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">x</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">l</span>. <span class="id" title="tactic">destruct</span> <span class="id" title="var">l</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;Some&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="var">H</span> <span class="id" title="keyword">with</span> (<span class="id" title="var">n</span>:=<span class="id" title="var">n</span>) <span class="id" title="tactic">by</span> <span class="id" title="tactic">apply</span> <span class="id" title="var">Heql</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;None&nbsp;*)</span> <span class="id" title="tactic">reflexivity</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
However, we will soon want our partial evaluator to remove
    assignments.  For example, it will simplify
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3; <span class="id" title="var">Y</span> := <span class="id" title="var">X</span> - <span class="id" title="var">Y</span>; <span class="id" title="var">X</span> := 4
</span>    to just
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := 3 - <span class="id" title="var">Y</span>; <span class="id" title="var">X</span> := 4
</span>    by delaying the assignment to <span class="inlinecode"><span class="id" title="var">X</span></span> until the end.  To accomplish
    this simplification, we need the result of partial evaluating
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">pe_aexp</span> [(<span class="id" title="var">X</span>,3)] (<span class="id" title="var">X</span> - <span class="id" title="var">Y</span>)
</span>    to be equal to <span class="inlinecode">3</span> <span class="inlinecode">-</span> <span class="inlinecode"><span class="id" title="var">Y</span></span> and <i>not</i> the original
    expression <span class="inlinecode"><span class="id" title="var">X</span></span> <span class="inlinecode">-</span> <span class="inlinecode"><span class="id" title="var">Y</span></span>.  After all, it would be
    incorrect, not just inefficient, to transform
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3; <span class="id" title="var">Y</span> := <span class="id" title="var">X</span> - <span class="id" title="var">Y</span>; <span class="id" title="var">X</span> := 4
</span>    to
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">X</span> - <span class="id" title="var">Y</span>; <span class="id" title="var">X</span> := 4
</span>    even though the output expressions <span class="inlinecode">3</span> <span class="inlinecode">-</span> <span class="inlinecode"><span class="id" title="var">Y</span></span> and
    <span class="inlinecode"><span class="id" title="var">X</span></span> <span class="inlinecode">-</span> <span class="inlinecode"><span class="id" title="var">Y</span></span> both satisfy the correctness criterion
    that we just proved.  Indeed, if we were to just define <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span>
    <span class="inlinecode"><span class="id" title="var">pe_st</span></span> <span class="inlinecode"><span class="id" title="var">a</span></span> <span class="inlinecode">=</span> <span class="inlinecode"><span class="id" title="var">a</span></span> then the theorem <span class="inlinecode"><span class="id" title="var">pe_aexp_correct_weak</span></span> would already
    trivially hold.

<div class="paragraph"> </div>

    Instead, we want to prove that the <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span> is correct in a
    stronger sense: evaluating the expression produced by partial
    evaluation (<span class="inlinecode"><span class="id" title="var">aeval</span></span> <span class="inlinecode"><span class="id" title="var">st</span></span> <span class="inlinecode">(<span class="id" title="var">pe_aexp</span></span> <span class="inlinecode"><span class="id" title="var">pe_st</span></span> <span class="inlinecode"><span class="id" title="var">a</span>)</span>) must not depend on those
    parts of the full state <span class="inlinecode"><span class="id" title="var">st</span></span> that are already specified in the
    partial state <span class="inlinecode"><span class="id" title="var">pe_st</span></span>.  To be more precise, let us define a
    function <span class="inlinecode"><span class="id" title="var">pe_override</span></span>, which updates <span class="inlinecode"><span class="id" title="var">st</span></span> with the contents of
    <span class="inlinecode"><span class="id" title="var">pe_st</span></span>.  In other words, <span class="inlinecode"><span class="id" title="var">pe_override</span></span> carries out the
    assignments listed in <span class="inlinecode"><span class="id" title="var">pe_st</span></span> on top of <span class="inlinecode"><span class="id" title="var">st</span></span>. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_update" class="idref" href="#pe_update"><span class="id" title="definition">pe_update</span></a> (<a id="st:31" class="idref" href="#st:31"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) (<a id="pe_st:32" class="idref" href="#pe_st:32"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) : <span class="id" title="definition">state</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_st:32"><span class="id" title="variable">pe_st</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <a class="idref" href="PE.html#st:31"><span class="id" title="variable">st</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">V</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a><span class="id" title="var">n</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">pe_st</span> ⇒ <span class="id" title="definition">t_update</span> (<a class="idref" href="PE.html#pe_update:33"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:31"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:32"><span class="id" title="variable">pe_st</span></a>) <span class="id" title="var">V</span> <span class="id" title="var">n</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="test_pe_update" class="idref" href="#test_pe_update"><span class="id" title="definition">test_pe_update</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> (<span class="id" title="definition">Y</span> <span class="id" title="notation">!<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span></span> 1) <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#e76c6291366b599375c28eba0aae94bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>3<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#e76c6291366b599375c28eba0aae94bb"><span class="id" title="notation">;</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">Z</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>2<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#e76c6291366b599375c28eba0aae94bb"><span class="id" title="notation">]</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span> <span class="id" title="notation">!<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span></span> 3 <span class="id" title="notation">;</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">!<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span></span> 2 <span class="id" title="notation">;</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">!<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span></span> 1<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">)</span></a>.<br/>
<div class="togglescript" id="proofcontrol3" onclick="toggleDisplay('proof3');toggleDisplay('proofcontrol3')"><span class="show"></span></div>
<div class="proofscript" id="proof3" onclick="toggleDisplay('proof3');toggleDisplay('proofcontrol3')">
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>
</div>

<div class="doc">
Although <span class="inlinecode"><span class="id" title="var">pe_update</span></span> operates on a concrete <span class="inlinecode"><span class="id" title="var">list</span></span> representing
    a <span class="inlinecode"><span class="id" title="var">pe_state</span></span>, its behavior is defined entirely by the <span class="inlinecode"><span class="id" title="var">pe_lookup</span></span>
    interpretation of the <span class="inlinecode"><span class="id" title="var">pe_state</span></span>. 
</div>
<div class="code">

<span class="id" title="keyword">Theorem</span> <a id="pe_update_correct" class="idref" href="#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>: <span class="id" title="keyword">∀</span> <a id="st:35" class="idref" href="#st:35"><span class="id" title="binder">st</span></a> <a id="pe_st:36" class="idref" href="#pe_st:36"><span class="id" title="binder">pe_st</span></a> <a id="V<sub>0</sub>:37" class="idref" href="#V<sub>0</sub>:37"><span class="id" title="binder">V<sub>0</sub></span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:35"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:36"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:37"><span class="id" title="variable">V<sub>0</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:36"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:37"><span class="id" title="variable">V<sub>0</sub></span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">n</span> ⇒ <span class="id" title="var">n</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> ⇒ <a class="idref" href="PE.html#st:35"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:37"><span class="id" title="variable">V<sub>0</sub></span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">pe_st</span> <span class="id" title="keyword">as</span> [| [<span class="id" title="var">V</span> <span class="id" title="var">n</span>] <span class="id" title="var">pe_st</span>]. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> ×. <span class="id" title="tactic">unfold</span> <span class="id" title="definition">t_update</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">compare</span> <span class="id" title="var">V<sub>0</sub></span> <span class="id" title="var">V</span>; <span class="id" title="tactic">auto</span>. <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="lemma">eqb_string_refl</span>; <span class="id" title="tactic">auto</span>. <span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">auto</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
We can relate <span class="inlinecode"><span class="id" title="var">pe_consistent</span></span> to <span class="inlinecode"><span class="id" title="var">pe_update</span></span> in two ways.
    First, overriding a state with a partial state always gives a
    state that is consistent with the partial state.  Second, if a
    state is already consistent with a partial state, then overriding
    the state with the partial state gives the same state. 
</div>
<div class="code">

<span class="id" title="keyword">Theorem</span> <a id="pe_update_consistent" class="idref" href="#pe_update_consistent"><span class="id" title="lemma">pe_update_consistent</span></a>: <span class="id" title="keyword">∀</span> <a id="st:38" class="idref" href="#st:38"><span class="id" title="binder">st</span></a> <a id="pe_st:39" class="idref" href="#pe_st:39"><span class="id" title="binder">pe_st</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_consistent"><span class="id" title="definition">pe_consistent</span></a> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:38"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:39"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#pe_st:39"><span class="id" title="variable">pe_st</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span> <span class="id" title="var">n</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span>); <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_consistent_update" class="idref" href="#pe_consistent_update"><span class="id" title="lemma">pe_consistent_update</span></a>: <span class="id" title="keyword">∀</span> <a id="st:40" class="idref" href="#st:40"><span class="id" title="binder">st</span></a> <a id="pe_st:41" class="idref" href="#pe_st:41"><span class="id" title="binder">pe_st</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_consistent"><span class="id" title="definition">pe_consistent</span></a> <a class="idref" href="PE.html#st:40"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:41"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="keyword">∀</span> <a id="V:42" class="idref" href="#V:42"><span class="id" title="binder">V</span></a>, <a class="idref" href="PE.html#st:40"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#V:42"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:40"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:41"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:42"><span class="id" title="variable">V</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">H</span> <span class="id" title="var">V</span>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">l</span>. <span class="id" title="tactic">destruct</span> <span class="id" title="var">l</span>; <span class="id" title="tactic">auto</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
Now we can state and prove that <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span> is correct in the
    stronger sense that will help us define the rest of the partial
    evaluator.

<div class="paragraph"> </div>

    Intuitively, running a program using partial evaluation is a
    two-stage process.  In the first, <i>static</i> stage, we partially
    evaluate the given program with respect to some partial state to
    get a <i>residual</i> program.  In the second, <i>dynamic</i> stage, we
    evaluate the residual program with respect to the rest of the
    state.  This dynamic state provides values for those variables
    that are unknown in the static (partial) state.  Thus, the
    residual program should be equivalent to <i>prepending</i> the
    assignments listed in the partial state to the original program. 
</div>
<div class="code">

<span class="id" title="keyword">Theorem</span> <a id="pe_aexp_correct" class="idref" href="#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>: <span class="id" title="keyword">∀</span> (<a id="pe_st:43" class="idref" href="#pe_st:43"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="a:44" class="idref" href="#a:44"><span class="id" title="binder">a</span></a>:<span class="id" title="inductive">aexp</span>) (<a id="st:45" class="idref" href="#st:45"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>),<br/>
&nbsp;&nbsp;<span class="id" title="definition">aeval</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:45"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:43"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#a:44"><span class="id" title="variable">a</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">aeval</span> <a class="idref" href="PE.html#st:45"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:43"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#a:44"><span class="id" title="variable">a</span></a>).<br/>
<span class="id" title="keyword">Proof</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">a</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">a</span>; <span class="id" title="tactic">simpl</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">reflexivity</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a<sub>1</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a<sub>2</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHa1</span>; <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHa2</span>; <span class="id" title="tactic">reflexivity</span>).<br/>
&nbsp;&nbsp;<span class="comment">(*&nbsp;Compared&nbsp;to&nbsp;fold_constants_aexp_sound,&nbsp;the&nbsp;only<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interesting&nbsp;case&nbsp;is&nbsp;AId.&nbsp;*)</span><br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>. <span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">x</span>); <span class="id" title="tactic">reflexivity</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab478"></a><h2 class="section">Boolean Expressions</h2>

<div class="paragraph"> </div>

 The partial evaluation of boolean expressions is similar.  In
    fact, it is entirely analogous to the constant folding of boolean
    expressions, because our language has no boolean variables. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_bexp" class="idref" href="#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> (<a id="pe_st:46" class="idref" href="#pe_st:46"><span class="id" title="binder">pe_st</span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="b:47" class="idref" href="#b:47"><span class="id" title="binder">b</span></a> : <span class="id" title="inductive">bexp</span>) : <span class="id" title="inductive">bexp</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#b:47"><span class="id" title="variable">b</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span>        ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span>      ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub></span> <span class="id" title="notation">=</span> <span class="id" title="var">a<sub>2</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="keyword">if</span> <span class="id" title="var">n<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#ad2ec4e405f68c46c0a176e3e94ae2e<sub>3</sub>"><span class="id" title="notation">=?</span></a> <span class="id" title="var">n<sub>2</sub></span> <span class="id" title="keyword">then</span> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <span class="id" title="keyword">else</span> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">a<sub>1</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">a<sub>2</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub>'</span> <span class="id" title="notation">=</span> <span class="id" title="var">a<sub>2</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub></span> <span class="id" title="notation">≤</span> <span class="id" title="var">a<sub>2</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="constructor">ANum</span> <span class="id" title="var">n<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="keyword">if</span> <span class="id" title="var">n<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#0f31f5c1c6b6a21a3a187247222bc9e<sub>4</sub>"><span class="id" title="notation">&lt;=?</span></a> <span class="id" title="var">n<sub>2</sub></span> <span class="id" title="keyword">then</span> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <span class="id" title="keyword">else</span> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">a<sub>1</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">a<sub>2</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="var">a<sub>1</sub>'</span> <span class="id" title="notation">≤</span> <span class="id" title="var">a<sub>2</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">¬</span> <span class="id" title="var">b<sub>1</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> (<a class="idref" href="PE.html#pe_bexp:48"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">b<sub>1</sub></span>) <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="var">b<sub>1</sub>'</span> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">¬</span> <span class="id" title="var">b<sub>1</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <span class="id" title="notation">&lt;{</span> <span class="id" title="var">b<sub>1</sub></span> <span class="id" title="notation">&amp;&amp;</span> <span class="id" title="var">b<sub>2</sub></span> <span class="id" title="notation">}&gt;</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_bexp:48"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">b<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#pe_bexp:48"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:46"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">b<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">b<sub>1</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">b<sub>2</sub>'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="var">b<sub>1</sub>'</span> <span class="id" title="notation">&amp;&amp;</span> <span class="id" title="var">b<sub>2</sub>'</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="test_pe_bexp1" class="idref" href="#test_pe_bexp1"><span class="id" title="definition">test_pe_bexp1</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>3<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">¬</span><span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">≤</span> 3<span class="id" title="notation">)</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span>.<br/>
<div class="togglescript" id="proofcontrol4" onclick="toggleDisplay('proof4');toggleDisplay('proofcontrol4')"><span class="show"></span></div>
<div class="proofscript" id="proof4" onclick="toggleDisplay('proof4');toggleDisplay('proofcontrol4')">
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<br/>
<span class="id" title="keyword">Example</span> <a id="test_pe_bexp2" class="idref" href="#test_pe_bexp2"><span class="id" title="definition">test_pe_bexp2</span></a>: <span class="id" title="keyword">∀</span> <a id="b:50" class="idref" href="#b:50"><span class="id" title="binder">b</span></a>:<span class="id" title="inductive">bexp</span>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#b:50"><span class="id" title="variable">b</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">¬</span><span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">≤</span> <span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">+</span> 1<span class="id" title="notation">))</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="PE.html#b:50"><span class="id" title="variable">b</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#b:50"><span class="id" title="variable">b</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">b</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
The correctness of <span class="inlinecode"><span class="id" title="var">pe_bexp</span></span> is analogous to the correctness of
    <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span> above. 
</div>
<div class="code">

<span class="id" title="keyword">Theorem</span> <a id="pe_bexp_correct" class="idref" href="#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>: <span class="id" title="keyword">∀</span> (<a id="pe_st:51" class="idref" href="#pe_st:51"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="b:52" class="idref" href="#b:52"><span class="id" title="binder">b</span></a>:<span class="id" title="inductive">bexp</span>) (<a id="st:53" class="idref" href="#st:53"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>),<br/>
&nbsp;&nbsp;<span class="id" title="definition">beval</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:53"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:51"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#b:52"><span class="id" title="variable">b</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">beval</span> <a class="idref" href="PE.html#st:53"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:51"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b:52"><span class="id" title="variable">b</span></a>).<br/>
<span class="id" title="keyword">Proof</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">b</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">b</span>; <span class="id" title="tactic">simpl</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">reflexivity</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a<sub>1</sub></span>) <span class="id" title="keyword">as</span> <span class="id" title="var">a<sub>1</sub>'</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a<sub>2</sub></span>) <span class="id" title="keyword">as</span> <span class="id" title="var">a<sub>2</sub>'</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">assert</span> (<span class="id" title="var">H<sub>1</sub></span>: <span class="id" title="definition">aeval</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span>) <span class="id" title="var">a<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">aeval</span> <span class="id" title="var">st</span> <span class="id" title="var">a<sub>1</sub>'</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">assert</span> (<span class="id" title="var">H<sub>2</sub></span>: <span class="id" title="definition">aeval</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span>) <span class="id" title="var">a<sub>2</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">aeval</span> <span class="id" title="var">st</span> <span class="id" title="var">a<sub>2</sub>'</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">subst</span>; <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> <span class="id" title="var">a<sub>1</sub>'</span>; <span class="id" title="tactic">destruct</span> <span class="id" title="var">a<sub>2</sub>'</span>; <span class="id" title="tactic">rewrite</span> <span class="id" title="var">H<sub>1</sub></span>; <span class="id" title="tactic">rewrite</span> <span class="id" title="var">H<sub>2</sub></span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">try</span> <span class="id" title="tactic">destruct</span> (<span class="id" title="var">n</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#ad2ec4e405f68c46c0a176e3e94ae2e<sub>3</sub>"><span class="id" title="notation">=?</span></a> <span class="id" title="var">n<sub>0</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">destruct</span> (<span class="id" title="var">n</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#0f31f5c1c6b6a21a3a187247222bc9e<sub>4</sub>"><span class="id" title="notation">&lt;=?</span></a> <span class="id" title="var">n<sub>0</sub></span>); <span class="id" title="tactic">reflexivity</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b</span>); <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHb</span>; <span class="id" title="tactic">reflexivity</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b<sub>1</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b<sub>2</sub></span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHb1</span>; <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHb2</span>; <span class="id" title="tactic">reflexivity</span>).<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab479"></a><h1 class="section">Partial Evaluation of Commands, Without Loops</h1>

<div class="paragraph"> </div>

 What about the partial evaluation of commands?  The analogy
    between partial evaluation and full evaluation continues: Just as
    full evaluation of a command turns an initial state into a final
    state, partial evaluation of a command turns an initial partial
    state into a final partial state.  The difference is that, because
    the state is partial, some parts of the command may not be
    executable at the static stage.  Therefore, just as <span class="inlinecode"><span class="id" title="var">pe_aexp</span></span>
    returns a residual <span class="inlinecode"><span class="id" title="var">aexp</span></span> and <span class="inlinecode"><span class="id" title="var">pe_bexp</span></span> returns a residual <span class="inlinecode"><span class="id" title="var">bexp</span></span>
    above, partially evaluating a command yields a residual command.

<div class="paragraph"> </div>

    Another way in which our partial evaluator is similar to a full
    evaluator is that it does not terminate on all commands.  It is
    not hard to build a partial evaluator that terminates on all
    commands; what is hard is building a partial evaluator that
    terminates on all commands yet automatically performs desired
    optimizations such as unrolling loops.  Often a partial evaluator
    can be coaxed into terminating more often and performing more
    optimizations by writing the source program differently so that
    the separation between static and dynamic information becomes more
    apparent.  Such coaxing is the art of <i>binding-time improvement</i>.
    The binding time of a variable tells when its value is known --
    either "static", or "dynamic."

<div class="paragraph"> </div>

    Anyway, for now we will just live with the fact that our partial
    evaluator is not a total function from the source command and the
    initial partial state to the residual command and the final
    partial state.  To model this non-termination, just as with the
    full evaluation of commands, we use an inductively defined
    relation.  We write
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">c<sub>1</sub></span> / <span class="id" title="var">st</span> ==&gt; <span class="id" title="var">c<sub>1</sub>'</span> / <span class="id" title="var">st'</span>
</span>    to mean that partially evaluating the source command <span class="inlinecode"><span class="id" title="var">c<sub>1</sub></span></span> in the
    initial partial state <span class="inlinecode"><span class="id" title="var">st</span></span> yields the residual command <span class="inlinecode"><span class="id" title="var">c<sub>1</sub>'</span></span> and
    the final partial state <span class="inlinecode"><span class="id" title="var">st'</span></span>.  For example, we want something like
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[] / (<span class="id" title="var">X</span> := 3 ; <span class="id" title="var">Y</span> := <span class="id" title="var">Z</span> × (<span class="id" title="var">X</span> + <span class="id" title="var">X</span>)) ==&gt; (<span class="id" title="var">Y</span> := <span class="id" title="var">Z</span> × 6) / [(<span class="id" title="var">X</span>,3)]
</span>    to hold.  The assignment to <span class="inlinecode"><span class="id" title="var">X</span></span> appears in the final partial state,
    not the residual command.

<div class="paragraph"> </div>

    (Writing something like <span class="inlinecode"><span class="id" title="var">st</span></span> <span class="inlinecode">=[</span> <span class="inlinecode"><span class="id" title="var">c<sub>1</sub></span></span> <span class="inlinecode">]=&gt;</span> <span class="inlinecode"><span class="id" title="var">c<sub>1</sub>'</span></span> <span class="inlinecode">/</span> <span class="inlinecode"><span class="id" title="var">st'</span></span> would be closer to
    the notation used in <a href="Imp.html"><span class="inlineref">Imp</span></a>; perhaps this should be changed!)

<div class="paragraph"> </div>

<a id="lab480"></a><h2 class="section">Assignment</h2>

<div class="paragraph"> </div>

 Let's start by considering how to partially evaluate an
    assignment.  The two assignments in the source program above needs
    to be treated differently.  The first assignment <span class="inlinecode"><span class="id" title="var">X</span></span> <span class="inlinecode">:=</span> <span class="inlinecode">3</span>,
    is <i>static</i>: its right-hand-side is a constant (more generally,
    simplifies to a constant), so we should update our partial state
    at <span class="inlinecode"><span class="id" title="var">X</span></span> to <span class="inlinecode">3</span> and produce no residual code.  (Actually, we produce
    a residual <span class="inlinecode"><span class="id" title="var">skip</span></span>.)  The second assignment <span class="inlinecode"><span class="id" title="var">Y</span></span> <span class="inlinecode">:=</span> <span class="inlinecode"><span class="id" title="var">Z</span></span> <span class="inlinecode">×</span> <span class="inlinecode">(<span class="id" title="var">X</span></span> <span class="inlinecode">+</span> <span class="inlinecode"><span class="id" title="var">X</span>)</span>
    is <i>dynamic</i>: its right-hand-side does
    not simplify to a constant, so we should leave it in the residual
    code and remove <span class="inlinecode"><span class="id" title="var">Y</span></span>, if present, from our partial state.  To
    implement these two cases, we define the functions <span class="inlinecode"><span class="id" title="var">pe_add</span></span> and
    <span class="inlinecode"><span class="id" title="var">pe_remove</span></span>.  Like <span class="inlinecode"><span class="id" title="var">pe_update</span></span> above, these functions operate on
    a concrete <span class="inlinecode"><span class="id" title="var">list</span></span> representing a <span class="inlinecode"><span class="id" title="var">pe_state</span></span>, but the theorems
    <span class="inlinecode"><span class="id" title="var">pe_add_correct</span></span> and <span class="inlinecode"><span class="id" title="var">pe_remove_correct</span></span> specify their behavior by
    the <span class="inlinecode"><span class="id" title="var">pe_lookup</span></span> interpretation of the <span class="inlinecode"><span class="id" title="var">pe_state</span></span>. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_remove" class="idref" href="#pe_remove"><span class="id" title="definition">pe_remove</span></a> (<a id="pe_st:54" class="idref" href="#pe_st:54"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="V:55" class="idref" href="#V:55"><span class="id" title="binder">V</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_st:54"><span class="id" title="variable">pe_st</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">V'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a><span class="id" title="var">n'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">pe_st</span> ⇒ <span class="id" title="keyword">if</span> <span class="id" title="definition">eqb_string</span> <a class="idref" href="PE.html#V:55"><span class="id" title="variable">V</span></a> <span class="id" title="var">V'</span> <span class="id" title="keyword">then</span> <a class="idref" href="PE.html#pe_remove:56"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:54"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:55"><span class="id" title="variable">V</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">else</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">V'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a><span class="id" title="var">n'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a> <a class="idref" href="PE.html#pe_remove:56"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:54"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:55"><span class="id" title="variable">V</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_remove_correct" class="idref" href="#pe_remove_correct"><span class="id" title="lemma">pe_remove_correct</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st:58" class="idref" href="#pe_st:58"><span class="id" title="binder">pe_st</span></a> <a id="V:59" class="idref" href="#V:59"><span class="id" title="binder">V</span></a> <a id="V<sub>0</sub>:60" class="idref" href="#V<sub>0</sub>:60"><span class="id" title="binder">V<sub>0</sub></span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> (<a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:58"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:59"><span class="id" title="variable">V</span></a>) <a class="idref" href="PE.html#V<sub>0</sub>:60"><span class="id" title="variable">V<sub>0</sub></span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="keyword">if</span> <span class="id" title="definition">eqb_string</span> <a class="idref" href="PE.html#V:59"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:60"><span class="id" title="variable">V<sub>0</sub></span></a> <span class="id" title="keyword">then</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> <span class="id" title="keyword">else</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:58"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:60"><span class="id" title="variable">V<sub>0</sub></span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">pe_st</span> <span class="id" title="keyword">as</span> [| [<span class="id" title="var">V'</span> <span class="id" title="var">n'</span>] <span class="id" title="var">pe_st</span>].<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="inlinecode"></span>&nbsp;*)</span> <span class="id" title="tactic">destruct</span> (<span class="id" title="definition">eqb_string</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>); <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;::&nbsp;*)</span> <span class="id" title="tactic">simpl</span>. <span class="id" title="var">compare</span> <span class="id" title="var">V</span> <span class="id" title="var">V'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHpe_st</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<span class="id" title="axiom">eqb_stringP</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>). <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;not&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">simpl</span>. <span class="id" title="var">compare</span> <span class="id" title="var">V<sub>0</sub></span> <span class="id" title="var">V'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;not&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHpe_st</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Definition</span> <a id="pe_add" class="idref" href="#pe_add"><span class="id" title="definition">pe_add</span></a> (<a id="pe_st:61" class="idref" href="#pe_st:61"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="V:62" class="idref" href="#V:62"><span class="id" title="binder">V</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) (<a id="n:63" class="idref" href="#n:63"><span class="id" title="binder">n</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>) : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> :=<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#V:62"><span class="id" title="variable">V</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a><a class="idref" href="PE.html#n:63"><span class="id" title="variable">n</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a> <a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:61"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:62"><span class="id" title="variable">V</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_add_correct" class="idref" href="#pe_add_correct"><span class="id" title="lemma">pe_add_correct</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st:64" class="idref" href="#pe_st:64"><span class="id" title="binder">pe_st</span></a> <a id="V:65" class="idref" href="#V:65"><span class="id" title="binder">V</span></a> <a id="n:66" class="idref" href="#n:66"><span class="id" title="binder">n</span></a> <a id="V<sub>0</sub>:67" class="idref" href="#V<sub>0</sub>:67"><span class="id" title="binder">V<sub>0</sub></span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> (<a class="idref" href="PE.html#pe_add"><span class="id" title="definition">pe_add</span></a> <a class="idref" href="PE.html#pe_st:64"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:65"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#n:66"><span class="id" title="variable">n</span></a>) <a class="idref" href="PE.html#V<sub>0</sub>:67"><span class="id" title="variable">V<sub>0</sub></span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="keyword">if</span> <span class="id" title="definition">eqb_string</span> <a class="idref" href="PE.html#V:65"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:67"><span class="id" title="variable">V<sub>0</sub></span></a> <span class="id" title="keyword">then</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <a class="idref" href="PE.html#n:66"><span class="id" title="variable">n</span></a> <span class="id" title="keyword">else</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:64"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V<sub>0</sub>:67"><span class="id" title="variable">V<sub>0</sub></span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span> <span class="id" title="var">n</span> <span class="id" title="var">V<sub>0</sub></span>. <span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#pe_add"><span class="id" title="definition">pe_add</span></a>. <span class="id" title="tactic">simpl</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">compare</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="lemma">eqb_string_refl</span>; <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;not&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_remove_correct"><span class="id" title="lemma">pe_remove_correct</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">repeat</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">auto</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
We will use the two theorems below to show that our partial
    evaluator correctly deals with dynamic assignments and static
    assignments, respectively. 
</div>
<div class="code">

<span class="id" title="keyword">Theorem</span> <a id="pe_update_update_remove" class="idref" href="#pe_update_update_remove"><span class="id" title="lemma">pe_update_update_remove</span></a>: <span class="id" title="keyword">∀</span> <a id="st:68" class="idref" href="#st:68"><span class="id" title="binder">st</span></a> <a id="pe_st:69" class="idref" href="#pe_st:69"><span class="id" title="binder">pe_st</span></a> <a id="V:70" class="idref" href="#V:70"><span class="id" title="binder">V</span></a> <a id="n:71" class="idref" href="#n:71"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;<span class="id" title="definition">t_update</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:68"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:69"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#V:70"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#n:71"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> (<span class="id" title="definition">t_update</span> <a class="idref" href="PE.html#st:68"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#V:70"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#n:71"><span class="id" title="variable">n</span></a>) (<a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:69"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:70"><span class="id" title="variable">V</span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span> <span class="id" title="var">n</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">V<sub>0</sub></span>. <span class="id" title="tactic">unfold</span> <span class="id" title="definition">t_update</span>. <span class="id" title="tactic">rewrite</span> !<a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_remove_correct"><span class="id" title="lemma">pe_remove_correct</span></a>. <span class="id" title="tactic">destruct</span> (<span class="id" title="definition">eqb_string</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>); <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_update_update_add" class="idref" href="#pe_update_update_add"><span class="id" title="lemma">pe_update_update_add</span></a>: <span class="id" title="keyword">∀</span> <a id="st:72" class="idref" href="#st:72"><span class="id" title="binder">st</span></a> <a id="pe_st:73" class="idref" href="#pe_st:73"><span class="id" title="binder">pe_st</span></a> <a id="V:74" class="idref" href="#V:74"><span class="id" title="binder">V</span></a> <a id="n:75" class="idref" href="#n:75"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;<span class="id" title="definition">t_update</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:72"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:73"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#V:74"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#n:75"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:72"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_add"><span class="id" title="definition">pe_add</span></a> <a class="idref" href="PE.html#pe_st:73"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:74"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#n:75"><span class="id" title="variable">n</span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span> <span class="id" title="var">n</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">V<sub>0</sub></span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">unfold</span> <span class="id" title="definition">t_update</span>. <span class="id" title="tactic">rewrite</span> !<a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_add_correct"><span class="id" title="lemma">pe_add_correct</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<span class="id" title="definition">eqb_string</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>); <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab481"></a><h2 class="section">Conditional</h2>

<div class="paragraph"> </div>

 Trickier than assignments to partially evaluate is the
    conditional, <span class="inlinecode"><span class="id" title="keyword">if</span></span> <span class="inlinecode"><span class="id" title="var">b<sub>1</sub></span></span> <span class="inlinecode"><span class="id" title="keyword">then</span></span> <span class="inlinecode"><span class="id" title="var">c<sub>1</sub></span></span> <span class="inlinecode"><span class="id" title="keyword">else</span></span> <span class="inlinecode"><span class="id" title="var">c<sub>2</sub></span></span> <span class="inlinecode"><span class="id" title="keyword">end</span></span>.  If <span class="inlinecode"><span class="id" title="var">b<sub>1</sub></span></span> simplifies to
    <span class="inlinecode"><span class="id" title="var">BTrue</span></span> or <span class="inlinecode"><span class="id" title="var">BFalse</span></span> then it's easy: we know which branch will be
    taken, so just take that branch.  If <span class="inlinecode"><span class="id" title="var">b<sub>1</sub></span></span> does not simplify to a
    constant, then we need to take both branches, and the final
    partial state may differ between the two branches!

<div class="paragraph"> </div>

    The following program illustrates the difficulty:
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 3;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">if</span> <span class="id" title="var">Y</span> ≤ 4 <span class="id" title="keyword">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := 4;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">if</span> <span class="id" title="var">X</span> ≤ <span class="id" title="var">Y</span> <span class="id" title="keyword">then</span> <span class="id" title="var">Y</span> := 999 <span class="id" title="keyword">else</span> <span class="id" title="var">skip</span> <span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">else</span> <span class="id" title="var">skip</span> <span class="id" title="keyword">end</span>
</span>    Suppose the initial partial state is empty.  We don't know
    statically how <span class="inlinecode"><span class="id" title="var">Y</span></span> compares to <span class="inlinecode">4</span>, so we must partially evaluate
    both branches of the (outer) conditional.  On the <span class="inlinecode"><span class="id" title="keyword">then</span></span> branch,
    we know that <span class="inlinecode"><span class="id" title="var">Y</span></span> is set to <span class="inlinecode">4</span> and can even use that knowledge to
    simplify the code somewhat.  On the <span class="inlinecode"><span class="id" title="keyword">else</span></span> branch, we still don't
    know the exact value of <span class="inlinecode"><span class="id" title="var">Y</span></span> at the end.  What should the final
    partial state and residual program be?

<div class="paragraph"> </div>

    One way to handle such a dynamic conditional is to take the
    intersection of the final partial states of the two branches.  In
    this example, we take the intersection of <span class="inlinecode">(<span class="id" title="var">Y</span>,4),(<span class="id" title="var">X</span>,3)</span> and
    <span class="inlinecode">(<span class="id" title="var">X</span>,3)</span>, so the overall final partial state is <span class="inlinecode">(<span class="id" title="var">X</span>,3)</span>.  To
    compensate for forgetting that <span class="inlinecode"><span class="id" title="var">Y</span></span> is <span class="inlinecode">4</span>, we need to add an
    assignment <span class="inlinecode"><span class="id" title="var">Y</span></span> <span class="inlinecode">:=</span> <span class="inlinecode">4</span> to the end of the <span class="inlinecode"><span class="id" title="keyword">then</span></span> branch.  So,
    the residual program will be something like
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">skip</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">if</span> <span class="id" title="var">Y</span> ≤ 4 <span class="id" title="keyword">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">skip</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">skip</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := 4<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">else</span> <span class="id" title="var">skip</span> <span class="id" title="keyword">end</span>
</span>    Programming this case in Coq calls for several auxiliary
    functions: we need to compute the intersection of two <span class="inlinecode"><span class="id" title="var">pe_state</span></span>s
    and turn their difference into sequences of assignments.

<div class="paragraph"> </div>

    First, we show how to compute whether two <span class="inlinecode"><span class="id" title="var">pe_state</span></span>s to disagree
    at a given variable.  In the theorem <span class="inlinecode"><span class="id" title="var">pe_disagree_domain</span></span>, we
    prove that two <span class="inlinecode"><span class="id" title="var">pe_state</span></span>s can only disagree at variables that
    appear in at least one of them. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="pe_disagree_at" class="idref" href="#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> (<a id="pe_st<sub>1</sub>:76" class="idref" href="#pe_st<sub>1</sub>:76"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:77" class="idref" href="#pe_st<sub>2</sub>:77"><span class="id" title="binder">pe_st<sub>2</sub></span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="V:78" class="idref" href="#V:78"><span class="id" title="binder">V</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:76"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#V:78"><span class="id" title="variable">V</span></a>, <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:77"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="PE.html#V:78"><span class="id" title="variable">V</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">x</span>, <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">y</span> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#negb"><span class="id" title="definition">negb</span></a> (<span class="id" title="var">x</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#ad2ec4e405f68c46c0a176e3e94ae2e<sub>3</sub>"><span class="id" title="notation">=?</span></a> <span class="id" title="var">y</span>)<br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a>, <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> ⇒ <span class="id" title="notation">false</span><br/>
&nbsp;&nbsp;| <span class="id" title="var">_</span>, <span class="id" title="var">_</span> ⇒ <span class="id" title="notation">true</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_disagree_domain" class="idref" href="#pe_disagree_domain"><span class="id" title="lemma">pe_disagree_domain</span></a>: <span class="id" title="keyword">∀</span> (<a id="pe_st<sub>1</sub>:79" class="idref" href="#pe_st<sub>1</sub>:79"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:80" class="idref" href="#pe_st<sub>2</sub>:80"><span class="id" title="binder">pe_st<sub>2</sub></span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="V:81" class="idref" href="#V:81"><span class="id" title="binder">V</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>),<br/>
&nbsp;&nbsp;<span class="id" title="notation">true</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:79"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:80"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="PE.html#V:81"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a> <a class="idref" href="PE.html#V:81"><span class="id" title="variable">V</span></a> (<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#map"><span class="id" title="definition">map</span></a> (@<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#fst"><span class="id" title="definition">fst</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span>) <a class="idref" href="PE.html#pe_st<sub>1</sub>:79"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#bc347c51eaf667706ae54503b26d52c<sub>6</sub>"><span class="id" title="notation">++</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#map"><span class="id" title="definition">map</span></a> (@<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#fst"><span class="id" title="definition">fst</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span>) <a class="idref" href="PE.html#pe_st<sub>2</sub>:80"><span class="id" title="variable">pe_st<sub>2</sub></span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#in_app_iff"><span class="id" title="lemma">in_app_iff</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">lookup1</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> <span class="id" title="var">lookup1</span> <span class="id" title="keyword">as</span> [<span class="id" title="var">n<sub>1</sub></span>|]. <span class="id" title="tactic">left</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_domain"><span class="id" title="lemma">pe_domain</span></a> <span class="id" title="keyword">with</span> <span class="id" title="var">n<sub>1</sub></span>. <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">lookup2</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> <span class="id" title="var">lookup2</span> <span class="id" title="keyword">as</span> [<span class="id" title="var">n<sub>2</sub></span>|]. <span class="id" title="tactic">right</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_domain"><span class="id" title="lemma">pe_domain</span></a> <span class="id" title="keyword">with</span> <span class="id" title="var">n<sub>2</sub></span>. <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
We define the <span class="inlinecode"><span class="id" title="var">pe_compare</span></span> function to list the variables where
    two given <span class="inlinecode"><span class="id" title="var">pe_state</span></span>s disagree.  This list is exact, according to
    the theorem <span class="inlinecode"><span class="id" title="var">pe_compare_correct</span></span>: a variable appears on the list
    if and only if the two given <span class="inlinecode"><span class="id" title="var">pe_state</span></span>s disagree at that
    variable.  Furthermore, we use the <span class="inlinecode"><span class="id" title="var">pe_unique</span></span> function to
    eliminate duplicates from the list. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_unique" class="idref" href="#pe_unique"><span class="id" title="definition">pe_unique</span></a> (<a id="l:82" class="idref" href="#l:82"><span class="id" title="binder">l</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#l:82"><span class="id" title="variable">l</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a><br/>
&nbsp;&nbsp;| <span class="id" title="var">x</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">l</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">x</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#filter"><span class="id" title="definition">filter</span></a> (<span class="id" title="keyword">fun</span> <a id="y:85" class="idref" href="#y:85"><span class="id" title="binder">y</span></a> ⇒ <span class="id" title="keyword">if</span> <span class="id" title="definition">eqb_string</span> <span class="id" title="var">x</span> <a class="idref" href="PE.html#y:85"><span class="id" title="variable">y</span></a> <span class="id" title="keyword">then</span> <span class="id" title="notation">false</span> <span class="id" title="keyword">else</span> <span class="id" title="notation">true</span>) (<a class="idref" href="PE.html#pe_unique:83"><span class="id" title="definition">pe_unique</span></a> <a class="idref" href="PE.html#l:82"><span class="id" title="variable">l</span></a>)<br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_unique_correct" class="idref" href="#pe_unique_correct"><span class="id" title="lemma">pe_unique_correct</span></a>: <span class="id" title="keyword">∀</span> <a id="l:86" class="idref" href="#l:86"><span class="id" title="binder">l</span></a> <a id="x:87" class="idref" href="#x:87"><span class="id" title="binder">x</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a> <a class="idref" href="PE.html#x:87"><span class="id" title="variable">x</span></a> <a class="idref" href="PE.html#l:86"><span class="id" title="variable">l</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">↔</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a> <a class="idref" href="PE.html#x:87"><span class="id" title="variable">x</span></a> (<a class="idref" href="PE.html#pe_unique"><span class="id" title="definition">pe_unique</span></a> <a class="idref" href="PE.html#l:86"><span class="id" title="variable">l</span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">l</span> <span class="id" title="var">x</span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">l</span> <span class="id" title="keyword">as</span> [| <span class="id" title="var">h</span> <span class="id" title="var">t</span>]. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> ×. <span class="id" title="tactic">split</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>; <span class="id" title="tactic">clear</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">left</span>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<span class="id" title="axiom">eqb_stringP</span> <span class="id" title="var">h</span> <span class="id" title="var">x</span>).<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">left</span>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">right</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#filter_In"><span class="id" title="lemma">filter_In</span></a>. <span class="id" title="tactic">split</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="var">IHt</span>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;&lt;-&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>; <span class="id" title="tactic">clear</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">left</span>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#filter_In"><span class="id" title="lemma">filter_In</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>0</sub></span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>0</sub></span>. <span class="id" title="tactic">right</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">IHt</span>. <span class="id" title="tactic">assumption</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Definition</span> <a id="pe_compare" class="idref" href="#pe_compare"><span class="id" title="definition">pe_compare</span></a> (<a id="pe_st<sub>1</sub>:88" class="idref" href="#pe_st<sub>1</sub>:88"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:89" class="idref" href="#pe_st<sub>2</sub>:89"><span class="id" title="binder">pe_st<sub>2</sub></span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a> :=<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_unique"><span class="id" title="definition">pe_unique</span></a> (<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#filter"><span class="id" title="definition">filter</span></a> (<a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:88"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:89"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;(<a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#map"><span class="id" title="definition">map</span></a> (@<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#fst"><span class="id" title="definition">fst</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span>) <a class="idref" href="PE.html#pe_st<sub>1</sub>:88"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#bc347c51eaf667706ae54503b26d52c<sub>6</sub>"><span class="id" title="notation">++</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#map"><span class="id" title="definition">map</span></a> (@<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#fst"><span class="id" title="definition">fst</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span>) <a class="idref" href="PE.html#pe_st<sub>2</sub>:89"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_compare_correct" class="idref" href="#pe_compare_correct"><span class="id" title="lemma">pe_compare_correct</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st<sub>1</sub>:90" class="idref" href="#pe_st<sub>1</sub>:90"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:91" class="idref" href="#pe_st<sub>2</sub>:91"><span class="id" title="binder">pe_st<sub>2</sub></span></a> <a id="V:92" class="idref" href="#V:92"><span class="id" title="binder">V</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:90"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#V:92"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:91"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="PE.html#V:92"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">↔</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#63a68285c81db8f9bc456233bb9ed181"><span class="id" title="notation">¬</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#In"><span class="id" title="definition">In</span></a> <a class="idref" href="PE.html#V:92"><span class="id" title="variable">V</span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:90"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:91"><span class="id" title="variable">pe_st<sub>2</sub></span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_unique_correct"><span class="id" title="lemma">pe_unique_correct</span></a>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#filter_In"><span class="id" title="lemma">filter_In</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">split</span>; <span class="id" title="tactic">intros</span> <span class="id" title="var">Heq</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intro</span>. <span class="id" title="tactic">destruct</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>0</sub></span>. <span class="id" title="tactic">rewrite</span> <span class="id" title="var">Heq</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>0</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>).<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.EqNat.html#beq_nat_refl"><span class="id" title="lemma">beq_nat_refl</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>0</sub></span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>0</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>0</sub></span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;&lt;-&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">assert</span> (<span class="id" title="var">Hagree</span>: <a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">false</span>).<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{ <span class="comment">(*&nbsp;Proof&nbsp;of&nbsp;assertion&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">disagree</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> <span class="id" title="var">disagree</span>; [| <span class="id" title="tactic">reflexivity</span>].<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span>  <a class="idref" href="PE.html#pe_disagree_domain"><span class="id" title="lemma">pe_disagree_domain</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heqdisagree</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">exfalso</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">Heq</span>. <span class="id" title="tactic">split</span>. <span class="id" title="tactic">assumption</span>. <span class="id" title="tactic">reflexivity</span>. }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#pe_disagree_at"><span class="id" title="definition">pe_disagree_at</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Hagree</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> [<span class="id" title="var">n<sub>1</sub></span>|];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> [<span class="id" title="var">n<sub>2</sub></span>|];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">reflexivity</span>; <span class="id" title="tactic">try</span> <span class="id" title="var">solve_by_invert</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Bool.Bool.html#negb_false_iff"><span class="id" title="lemma">negb_false_iff</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Hagree</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.PeanoNat.html#Nat.eqb_eq"><span class="id" title="lemma">eqb_eq</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Hagree</span>. <span class="id" title="tactic">subst</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
The intersection of two partial states is the result of removing
    from one of them all the variables where the two disagree.  We
    define the function <span class="inlinecode"><span class="id" title="var">pe_removes</span></span>, in terms of <span class="inlinecode"><span class="id" title="var">pe_remove</span></span> above,
    to perform such a removal of a whole list of variables at once.

<div class="paragraph"> </div>

    The theorem <span class="inlinecode"><span class="id" title="var">pe_compare_removes</span></span> testifies that the <span class="inlinecode"><span class="id" title="var">pe_lookup</span></span>
    interpretation of the result of this intersection operation is the
    same no matter which of the two partial states we remove the
    variables from.  Because <span class="inlinecode"><span class="id" title="var">pe_update</span></span> only depends on the
    <span class="inlinecode"><span class="id" title="var">pe_lookup</span></span> interpretation of partial states, <span class="inlinecode"><span class="id" title="var">pe_update</span></span> also
    does not care which of the two partial states we remove the
    variables from; that theorem <span class="inlinecode"><span class="id" title="var">pe_compare_update</span></span> is used in the
    correctness proof shortly. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_removes" class="idref" href="#pe_removes"><span class="id" title="definition">pe_removes</span></a> (<a id="pe_st:93" class="idref" href="#pe_st:93"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="ids:94" class="idref" href="#ids:94"><span class="id" title="binder">ids</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#ids:94"><span class="id" title="variable">ids</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <a class="idref" href="PE.html#pe_st:93"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;| <span class="id" title="var">V</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">ids</span> ⇒ <a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> (<a class="idref" href="PE.html#pe_removes:95"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st:93"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:94"><span class="id" title="variable">ids</span></a>) <span class="id" title="var">V</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_removes_correct" class="idref" href="#pe_removes_correct"><span class="id" title="lemma">pe_removes_correct</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st:97" class="idref" href="#pe_st:97"><span class="id" title="binder">pe_st</span></a> <a id="ids:98" class="idref" href="#ids:98"><span class="id" title="binder">ids</span></a> <a id="V:99" class="idref" href="#V:99"><span class="id" title="binder">V</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> (<a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st:97"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:98"><span class="id" title="variable">ids</span></a>) <a class="idref" href="PE.html#V:99"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">if</span> <a class="idref" href="PE.html#inb"><span class="id" title="definition">inb</span></a> <span class="id" title="definition">eqb_string</span> <a class="idref" href="PE.html#V:99"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#ids:98"><span class="id" title="variable">ids</span></a> <span class="id" title="keyword">then</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> <span class="id" title="keyword">else</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:97"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:99"><span class="id" title="variable">V</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">ids</span> <span class="id" title="var">V</span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">ids</span> <span class="id" title="keyword">as</span> [| <span class="id" title="var">V'</span> <span class="id" title="var">ids</span>]. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">simpl</span>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_remove_correct"><span class="id" title="lemma">pe_remove_correct</span></a>. <span class="id" title="tactic">rewrite</span> <span class="id" title="var">IHids</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">compare</span> <span class="id" title="var">V'</span> <span class="id" title="var">V</span>.<br/>
&nbsp;&nbsp;- <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="lemma">eqb_string_refl</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">try</span> <span class="id" title="tactic">congruence</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_compare_removes" class="idref" href="#pe_compare_removes"><span class="id" title="lemma">pe_compare_removes</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st<sub>1</sub>:100" class="idref" href="#pe_st<sub>1</sub>:100"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:101" class="idref" href="#pe_st<sub>2</sub>:101"><span class="id" title="binder">pe_st<sub>2</sub></span></a> <a id="V:102" class="idref" href="#V:102"><span class="id" title="binder">V</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> (<a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:100"><span class="id" title="variable">pe_st<sub>1</sub></span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:100"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:101"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)) <a class="idref" href="PE.html#V:102"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> (<a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:101"><span class="id" title="variable">pe_st<sub>2</sub></span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:100"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:101"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)) <a class="idref" href="PE.html#V:102"><span class="id" title="variable">V</span></a>.<br/>
<span class="id" title="keyword">Proof</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>. <span class="id" title="tactic">rewrite</span> !<a class="idref" href="PE.html#pe_removes_correct"><span class="id" title="lemma">pe_removes_correct</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#inbP"><span class="id" title="lemma">inbP</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="axiom">eqb_stringP</span> <span class="id" title="var">V</span> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span>)).<br/>
&nbsp;&nbsp;- <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_compare_correct"><span class="id" title="lemma">pe_compare_correct</span></a>. <span class="id" title="tactic">auto</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_compare_update" class="idref" href="#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st<sub>1</sub>:103" class="idref" href="#pe_st<sub>1</sub>:103"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:104" class="idref" href="#pe_st<sub>2</sub>:104"><span class="id" title="binder">pe_st<sub>2</sub></span></a> <a id="st:105" class="idref" href="#st:105"><span class="id" title="binder">st</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:105"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:103"><span class="id" title="variable">pe_st<sub>1</sub></span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:103"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:104"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)) <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:105"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:104"><span class="id" title="variable">pe_st<sub>2</sub></span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:103"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:104"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">V</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> !<a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_compare_removes"><span class="id" title="lemma">pe_compare_removes</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
Finally, we define an <span class="inlinecode"><span class="id" title="var">assign</span></span> function to turn the difference
    between two partial states into a sequence of assignment commands.
    More precisely, <span class="inlinecode"><span class="id" title="var">assign</span></span> <span class="inlinecode"><span class="id" title="var">pe_st</span></span> <span class="inlinecode"><span class="id" title="var">ids</span></span> generates an assignment command
    for each variable listed in <span class="inlinecode"><span class="id" title="var">ids</span></span>. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="assign" class="idref" href="#assign"><span class="id" title="definition">assign</span></a> (<a id="pe_st:106" class="idref" href="#pe_st:106"><span class="id" title="binder">pe_st</span></a> : <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="ids:107" class="idref" href="#ids:107"><span class="id" title="binder">ids</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) : <span class="id" title="inductive">com</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#ids:107"><span class="id" title="variable">ids</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> ⇒ <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <span class="id" title="var">V</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#::list_scope:x_'::'_x"><span class="id" title="notation">::</span></a><span class="id" title="var">ids</span> ⇒ <span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:106"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">V</span> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">n</span> ⇒ <span class="id" title="notation">&lt;{</span> <a class="idref" href="PE.html#assign:108"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st:106"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:107"><span class="id" title="variable">ids</span></a><span class="id" title="notation">;</span> <span class="id" title="var">V</span> <span class="id" title="notation">:=</span> <span class="id" title="var">n</span> <span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> ⇒ <a class="idref" href="PE.html#assign:108"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st:106"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:107"><span class="id" title="variable">ids</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
</div>

<div class="doc">
The command generated by <span class="inlinecode"><span class="id" title="var">assign</span></span> always terminates, because it is
    just a sequence of assignments.  The (total) function <span class="inlinecode"><span class="id" title="var">assigned</span></span>
    below computes the effect of the command on the (dynamic state).
    The theorem <span class="inlinecode"><span class="id" title="var">assign_removes</span></span> then confirms that the generated
    assignments perfectly compensate for removing the variables from
    the partial state. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="assigned" class="idref" href="#assigned"><span class="id" title="definition">assigned</span></a> (<a id="pe_st:110" class="idref" href="#pe_st:110"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="ids:111" class="idref" href="#ids:111"><span class="id" title="binder">ids</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#list"><span class="id" title="inductive">list</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a>) (<a id="st:112" class="idref" href="#st:112"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) : <span class="id" title="definition">state</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">fun</span> <a id="V:113" class="idref" href="#V:113"><span class="id" title="binder">V</span></a> ⇒ <span class="id" title="keyword">if</span> <a class="idref" href="PE.html#inb"><span class="id" title="definition">inb</span></a> <span class="id" title="definition">eqb_string</span> <a class="idref" href="PE.html#V:113"><span class="id" title="variable">V</span></a> <a class="idref" href="PE.html#ids:111"><span class="id" title="variable">ids</span></a> <span class="id" title="keyword">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st:110"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#V:113"><span class="id" title="variable">V</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <span class="id" title="var">n</span> ⇒ <span class="id" title="var">n</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> ⇒ <a class="idref" href="PE.html#st:112"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#V:113"><span class="id" title="variable">V</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">else</span> <a class="idref" href="PE.html#st:112"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#V:113"><span class="id" title="variable">V</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="assign_removes" class="idref" href="#assign_removes"><span class="id" title="lemma">assign_removes</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st:114" class="idref" href="#pe_st:114"><span class="id" title="binder">pe_st</span></a> <a id="ids:115" class="idref" href="#ids:115"><span class="id" title="binder">ids</span></a> <a id="st:116" class="idref" href="#st:116"><span class="id" title="binder">st</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:116"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:114"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> (<a class="idref" href="PE.html#assigned"><span class="id" title="definition">assigned</span></a> <a class="idref" href="PE.html#pe_st:114"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:115"><span class="id" title="variable">ids</span></a> <a class="idref" href="PE.html#st:116"><span class="id" title="variable">st</span></a>) (<a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st:114"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:115"><span class="id" title="variable">ids</span></a>).<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">ids</span> <span class="id" title="var">st</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">V</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> !<a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_removes_correct"><span class="id" title="lemma">pe_removes_correct</span></a>. <span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#assigned"><span class="id" title="definition">assigned</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#inbP"><span class="id" title="lemma">inbP</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="axiom">eqb_stringP</span> <span class="id" title="var">V</span> <span class="id" title="var">ids</span>); <span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span>); <span class="id" title="tactic">reflexivity</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Lemma</span> <a id="ceval_extensionality" class="idref" href="#ceval_extensionality"><span class="id" title="lemma">ceval_extensionality</span></a>: <span class="id" title="keyword">∀</span> <a id="c:117" class="idref" href="#c:117"><span class="id" title="binder">c</span></a> <a id="st:118" class="idref" href="#st:118"><span class="id" title="binder">st</span></a> <a id="st<sub>1</sub>:119" class="idref" href="#st<sub>1</sub>:119"><span class="id" title="binder">st<sub>1</sub></span></a> <a id="st<sub>2</sub>:120" class="idref" href="#st<sub>2</sub>:120"><span class="id" title="binder">st<sub>2</sub></span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#st:118"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:117"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st<sub>1</sub>:119"><span class="id" title="variable">st<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><span class="id" title="keyword">∀</span> <a id="V:121" class="idref" href="#V:121"><span class="id" title="binder">V</span></a>, <a class="idref" href="PE.html#st<sub>1</sub>:119"><span class="id" title="variable">st<sub>1</sub></span></a> <a class="idref" href="PE.html#V:121"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#st<sub>2</sub>:120"><span class="id" title="variable">st<sub>2</sub></span></a> <a class="idref" href="PE.html#V:121"><span class="id" title="variable">V</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#st:118"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:117"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st<sub>2</sub>:120"><span class="id" title="variable">st<sub>2</sub></span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">st</span> <span class="id" title="var">st<sub>1</sub></span> <span class="id" title="var">st<sub>2</sub></span> <span class="id" title="var">H</span> <span class="id" title="var">Heq</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heq</span>. <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="var">Heq</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">H</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="eval_assign" class="idref" href="#eval_assign"><span class="id" title="lemma">eval_assign</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st:122" class="idref" href="#pe_st:122"><span class="id" title="binder">pe_st</span></a> <a id="ids:123" class="idref" href="#ids:123"><span class="id" title="binder">ids</span></a> <a id="st:124" class="idref" href="#st:124"><span class="id" title="binder">st</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#st:124"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st:122"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:123"><span class="id" title="variable">ids</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#assigned"><span class="id" title="definition">assigned</span></a> <a class="idref" href="PE.html#pe_st:122"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#ids:123"><span class="id" title="variable">ids</span></a> <a class="idref" href="PE.html#st:124"><span class="id" title="variable">st</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">ids</span> <span class="id" title="var">st</span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">ids</span> <span class="id" title="keyword">as</span> [| <span class="id" title="var">V</span> <span class="id" title="var">ids</span>]; <span class="id" title="tactic">simpl</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="inlinecode"></span>&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#ceval_extensionality"><span class="id" title="lemma">ceval_extensionality</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_Skip</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;V::ids&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">V</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">lookup</span>. <span class="id" title="tactic">destruct</span> <span class="id" title="var">lookup</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;Some&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">IHids</span>. <span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#assigned"><span class="id" title="definition">assigned</span></a>. <span class="id" title="tactic">simpl</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#ceval_extensionality"><span class="id" title="lemma">ceval_extensionality</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_Asgn</span>. <span class="id" title="tactic">simpl</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">V<sub>0</sub></span>. <span class="id" title="tactic">unfold</span> <span class="id" title="definition">t_update</span>. <span class="id" title="var">compare</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="var">Heqlookup</span>. <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="lemma">eqb_string_refl</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;not&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">congruence</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;None&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#ceval_extensionality"><span class="id" title="lemma">ceval_extensionality</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="var">IHids</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">unfold</span> <a class="idref" href="PE.html#assigned"><span class="id" title="definition">assigned</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">V<sub>0</sub></span>. <span class="id" title="tactic">simpl</span>. <span class="id" title="var">compare</span> <span class="id" title="var">V</span> <span class="id" title="var">V<sub>0</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="var">Heqlookup</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <span class="id" title="lemma">eqb_string_refl</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#inbP"><span class="id" title="lemma">inbP</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="axiom">eqb_stringP</span> <span class="id" title="var">V</span> <span class="id" title="var">ids</span>); <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;not&nbsp;equal&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <span class="id" title="lemma">false_eqb_string</span>; <span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">congruence</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab482"></a><h2 class="section">The Partial Evaluation Relation</h2>

<div class="paragraph"> </div>

 At long last, we can define a partial evaluator for commands
    without loops, as an inductive relation!  The inequality
    conditions in <span class="inlinecode"><span class="id" title="var">PE_AsgnDynamic</span></span> and <span class="inlinecode"><span class="id" title="var">PE_If</span></span> are just to keep the
    partial evaluator deterministic; they are not required for
    correctness. 
</div>
<div class="code">

<span class="id" title="keyword">Reserved Notation</span> &quot;c<sub>1</sub> '/' st '==&gt;' c<sub>1</sub>' '/' st'"<br/>
&nbsp;&nbsp;(<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 40, <span class="id" title="var">st</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">c<sub>1</sub>'</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Inductive</span> <a id="pe_com" class="idref" href="#pe_com"><span class="id" title="inductive">pe_com</span></a> : <span class="id" title="inductive">com</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="inductive">com</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="PE_Skip" class="idref" href="#PE_Skip"><span class="id" title="constructor">PE_Skip</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:127" class="idref" href="#pe_st:127"><span class="id" title="binder">pe_st</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:127"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:127"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;| <a id="PE_AsgnStatic" class="idref" href="#PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:128" class="idref" href="#pe_st:128"><span class="id" title="binder">pe_st</span></a> <a id="a<sub>1</sub>:129" class="idref" href="#a<sub>1</sub>:129"><span class="id" title="binder">a<sub>1</sub></span></a> (<a id="n<sub>1</sub>:130" class="idref" href="#n<sub>1</sub>:130"><span class="id" title="binder">n<sub>1</sub></span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>) <a id="l:131" class="idref" href="#l:131"><span class="id" title="binder">l</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:128"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#a<sub>1</sub>:129"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <a class="idref" href="PE.html#n<sub>1</sub>:130"><span class="id" title="variable">n<sub>1</sub></span></a> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#l:131"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>:129"><span class="id" title="variable">a<sub>1</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:128"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_add"><span class="id" title="definition">pe_add</span></a> <a class="idref" href="PE.html#pe_st:128"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#l:131"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#n<sub>1</sub>:130"><span class="id" title="variable">n<sub>1</sub></span></a><br/>
&nbsp;&nbsp;| <a id="PE_AsgnDynamic" class="idref" href="#PE_AsgnDynamic"><span class="id" title="constructor">PE_AsgnDynamic</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:132" class="idref" href="#pe_st:132"><span class="id" title="binder">pe_st</span></a> <a id="a<sub>1</sub>:133" class="idref" href="#a<sub>1</sub>:133"><span class="id" title="binder">a<sub>1</sub></span></a> <a id="a<sub>1</sub>':134" class="idref" href="#a<sub>1</sub>':134"><span class="id" title="binder">a<sub>1</sub>'</span></a> <a id="l:135" class="idref" href="#l:135"><span class="id" title="binder">l</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:132"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#a<sub>1</sub>:133"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#a<sub>1</sub>':134"><span class="id" title="variable">a<sub>1</sub>'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><span class="id" title="keyword">∀</span> <a id="n:136" class="idref" href="#n:136"><span class="id" title="binder">n</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a> , <a class="idref" href="PE.html#a<sub>1</sub>':134"><span class="id" title="variable">a<sub>1</sub>'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <a class="idref" href="PE.html#n:136"><span class="id" title="variable">n</span></a> <span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#l:135"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>:133"><span class="id" title="variable">a<sub>1</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:132"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#l:135"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>':134"><span class="id" title="variable">a<sub>1</sub>'</span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:132"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#l:135"><span class="id" title="variable">l</span></a><br/>
&nbsp;&nbsp;| <a id="PE_Seq" class="idref" href="#PE_Seq"><span class="id" title="constructor">PE_Seq</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:137" class="idref" href="#pe_st:137"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':138" class="idref" href="#pe_st':138"><span class="id" title="binder">pe_st'</span></a> <a id="pe_st'':139" class="idref" href="#pe_st'':139"><span class="id" title="binder">pe_st''</span></a> <a id="c<sub>1</sub>:140" class="idref" href="#c<sub>1</sub>:140"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:141" class="idref" href="#c<sub>2</sub>:141"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>1</sub>':142" class="idref" href="#c<sub>1</sub>':142"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':143" class="idref" href="#c<sub>2</sub>':143"><span class="id" title="binder">c<sub>2</sub>'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:140"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:137"><span class="id" title="variable">pe_st</span></a>  <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':142"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':138"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:141"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':138"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':143"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':139"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#c<sub>1</sub>:140"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>:141"><span class="id" title="variable">c<sub>2</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:137"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#c<sub>1</sub>':142"><span class="id" title="variable">c<sub>1</sub>'</span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>':143"><span class="id" title="variable">c<sub>2</sub>'</span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':139"><span class="id" title="variable">pe_st''</span></a><br/>
&nbsp;&nbsp;| <a id="PE_IfTrue" class="idref" href="#PE_IfTrue"><span class="id" title="constructor">PE_IfTrue</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:144" class="idref" href="#pe_st:144"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':145" class="idref" href="#pe_st':145"><span class="id" title="binder">pe_st'</span></a> <a id="b<sub>1</sub>:146" class="idref" href="#b<sub>1</sub>:146"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:147" class="idref" href="#c<sub>1</sub>:147"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:148" class="idref" href="#c<sub>2</sub>:148"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>1</sub>':149" class="idref" href="#c<sub>1</sub>':149"><span class="id" title="binder">c<sub>1</sub>'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:144"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:146"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:147"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:144"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':149"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':145"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:146"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:147"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:148"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:144"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':149"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':145"><span class="id" title="variable">pe_st'</span></a><br/>
&nbsp;&nbsp;| <a id="PE_IfFalse" class="idref" href="#PE_IfFalse"><span class="id" title="constructor">PE_IfFalse</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:150" class="idref" href="#pe_st:150"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':151" class="idref" href="#pe_st':151"><span class="id" title="binder">pe_st'</span></a> <a id="b<sub>1</sub>:152" class="idref" href="#b<sub>1</sub>:152"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:153" class="idref" href="#c<sub>1</sub>:153"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:154" class="idref" href="#c<sub>2</sub>:154"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>2</sub>':155" class="idref" href="#c<sub>2</sub>':155"><span class="id" title="binder">c<sub>2</sub>'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:150"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:152"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="constructor">BFalse</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:154"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:150"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':155"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':151"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:152"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:153"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:154"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:150"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':155"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':151"><span class="id" title="variable">pe_st'</span></a><br/>
&nbsp;&nbsp;| <a id="PE_If" class="idref" href="#PE_If"><span class="id" title="constructor">PE_If</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:156" class="idref" href="#pe_st:156"><span class="id" title="binder">pe_st</span></a> <a id="pe_st<sub>1</sub>:157" class="idref" href="#pe_st<sub>1</sub>:157"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:158" class="idref" href="#pe_st<sub>2</sub>:158"><span class="id" title="binder">pe_st<sub>2</sub></span></a> <a id="b<sub>1</sub>:159" class="idref" href="#b<sub>1</sub>:159"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:160" class="idref" href="#c<sub>1</sub>:160"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:161" class="idref" href="#c<sub>2</sub>:161"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>1</sub>':162" class="idref" href="#c<sub>1</sub>':162"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':163" class="idref" href="#c<sub>2</sub>':163"><span class="id" title="binder">c<sub>2</sub>'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:156"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:159"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:156"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:159"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:160"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:156"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':162"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:157"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:161"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:156"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':163"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:158"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:159"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:160"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:161"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:156"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:156"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:159"><span class="id" title="variable">b<sub>1</sub></span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>':162"><span class="id" title="variable">c<sub>1</sub>'</span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:157"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <span class="id" title="notation">(</span><a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:157"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:158"><span class="id" title="variable">pe_st<sub>2</sub></span></a><span class="id" title="notation">)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>':163"><span class="id" title="variable">c<sub>2</sub>'</span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:158"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <span class="id" title="notation">(</span><a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:157"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:158"><span class="id" title="variable">pe_st<sub>2</sub></span></a><span class="id" title="notation">)</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:157"><span class="id" title="variable">pe_st<sub>1</sub></span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:157"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:158"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)<br/>
<br/>
&nbsp;&nbsp;<span class="id" title="keyword">where</span> <a id="b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>" class="idref" href="#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">&quot;</span></a>c<sub>1</sub> '/' st '==&gt;' c<sub>1</sub>' '/' st'" := (<a class="idref" href="PE.html#pe_com:126"><span class="id" title="inductive">pe_com</span></a> <span class="id" title="var">c<sub>1</sub></span> <span class="id" title="var">st</span> <span class="id" title="var">c<sub>1</sub>'</span> <span class="id" title="var">st'</span>).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Local Hint Constructors</span> <a class="idref" href="PE.html#pe_com"><span class="id" title="inductive">pe_com</span></a> : <span class="id" title="var">core</span>.<br/>
<span class="id" title="keyword">Local Hint Constructors</span> <a class="idref" href="PE.html#ceval"><span class="id" title="inductive">ceval</span></a> : <span class="id" title="var">core</span>.<br/>
</div>

<div class="doc">
<a id="lab483"></a><h2 class="section">Examples</h2>

<div class="paragraph"> </div>

 Below are some examples of using the partial evaluator.  To make
    the <span class="inlinecode"><span class="id" title="var">pe_com</span></span> relation actually usable for automatic partial
    evaluation, we would need to define more automation tactics in
    Coq.  That is not hard to do, but it is not needed here. 
</div>
<div class="code">

<span class="id" title="keyword">Example</span> <a id="pe_example1" class="idref" href="#pe_example1"><span class="id" title="definition">pe_example1</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 3 <span class="id" title="notation">;</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">×</span> <span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">+</span> <span class="id" title="definition">X</span><span class="id" title="notation">)</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">×</span> 6<span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>3<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_AsgnDynamic"><span class="id" title="constructor">PE_AsgnDynamic</span></a>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">n</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="pe_example2" class="idref" href="#pe_example2"><span class="id" title="definition">pe_example2</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 3 <span class="id" title="notation">;</span> <span class="id" title="notation">if</span> <span class="id" title="definition">X</span> <span class="id" title="notation">≤</span> 4 <span class="id" title="notation">then</span> <span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 4 <span class="id" title="notation">else</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>4<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_IfTrue"><span class="id" title="constructor">PE_IfTrue</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="pe_example3" class="idref" href="#pe_example3"><span class="id" title="definition">pe_example3</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 3<span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;<span class="id" title="notation">if</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">≤</span> 4 <span class="id" title="notation">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> 4<span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">if</span> <span class="id" title="definition">X</span> <span class="id" title="notation">=</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">then</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> 999 <span class="id" title="notation">else</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">end</span><br/>
&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">if</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">≤</span> 4 <span class="id" title="notation">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><span class="id" title="notation">)</span><span class="id" title="notation">;</span> <span class="id" title="notation">(</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> 4<span class="id" title="notation">)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>3<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f_equal2"><span class="id" title="lemma">f_equal2</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">f</span> := <span class="id" title="keyword">fun</span> <a id="c:172" class="idref" href="#c:172"><span class="id" title="binder">c</span></a> <a id="st:173" class="idref" href="#st:173"><span class="id" title="binder">st</span></a> ⇒ <span class="id" title="var">_</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <span class="id" title="var">_</span> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c:164"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:165"><span class="id" title="variable">st</span></a>).<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_If"><span class="id" title="constructor">PE_If</span></a>; <span class="id" title="tactic">intuition</span> <span class="id" title="tactic">eauto</span>; <span class="id" title="tactic">try</span> <span class="id" title="var">solve_by_invert</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#PE_IfFalse"><span class="id" title="constructor">PE_IfFalse</span></a>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">econstructor</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab484"></a><h2 class="section">Correctness of Partial Evaluation</h2>

<div class="paragraph"> </div>

 Finally let's prove that this partial evaluator is correct! 
</div>
<div class="code">

<span class="id" title="keyword">Reserved Notation</span> &quot;c' '/' pe_st' '/' st '==&gt;' st''"<br/>
&nbsp;&nbsp;(<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 40, <span class="id" title="var">pe_st'</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">st</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Inductive</span> <a id="pe_ceval" class="idref" href="#pe_ceval"><span class="id" title="inductive">pe_ceval</span></a><br/>
&nbsp;&nbsp;(<a id="c':174" class="idref" href="#c':174"><span class="id" title="binder">c'</span></a>:<span class="id" title="inductive">com</span>) (<a id="pe_st':175" class="idref" href="#pe_st':175"><span class="id" title="binder">pe_st'</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="st:176" class="idref" href="#st:176"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) (<a id="st'':177" class="idref" href="#st'':177"><span class="id" title="binder">st''</span></a>:<span class="id" title="definition">state</span>) : <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="pe_ceval_intro" class="idref" href="#pe_ceval_intro"><span class="id" title="constructor">pe_ceval_intro</span></a> : <span class="id" title="keyword">∀</span> <a id="st':180" class="idref" href="#st':180"><span class="id" title="binder">st'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#st:176"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c':174"><span class="id" title="variable">c'</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st':180"><span class="id" title="variable">st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st':180"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#pe_st':175"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#st'':177"><span class="id" title="variable">st''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c':174"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':175"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:176"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':177"><span class="id" title="variable">st''</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">where</span> <a id="9080f57e2483ed1c9ac1940b94629a9a" class="idref" href="#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">&quot;</span></a>c' '/' pe_st' '/' st '==&gt;' st''" := (<a class="idref" href="PE.html#pe_ceval:179"><span class="id" title="inductive">pe_ceval</span></a> <span class="id" title="var">c'</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span>).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Local Hint Constructors</span> <a class="idref" href="PE.html#pe_ceval"><span class="id" title="inductive">pe_ceval</span></a> : <span class="id" title="var">core</span>.<br/><hr class='doublespaceincode'/>
<span class="comment">(*&nbsp;NOTATION&nbsp;:&nbsp;IY&nbsp;--&nbsp;The&nbsp;"If"&nbsp;case&nbsp;line&nbsp;spacing&nbsp;looks&nbsp;a&nbsp;little&nbsp;off---what&nbsp;are&nbsp;the&nbsp;line<br/>
&nbsp;&nbsp;&nbsp;break&nbsp;insert&nbsp;rules&nbsp;for&nbsp;Imp?&nbsp;*)</span><br/>
<span class="id" title="keyword">Theorem</span> <a id="pe_com_complete" class="idref" href="#pe_com_complete"><span class="id" title="lemma">pe_com_complete</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="c:181" class="idref" href="#c:181"><span class="id" title="binder">c</span></a> <a id="pe_st:182" class="idref" href="#pe_st:182"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':183" class="idref" href="#pe_st':183"><span class="id" title="binder">pe_st'</span></a> <a id="c':184" class="idref" href="#c':184"><span class="id" title="binder">c'</span></a>, <a class="idref" href="PE.html#c:181"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:182"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c':184"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':183"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:185" class="idref" href="#st:185"><span class="id" title="binder">st</span></a> <a id="st'':186" class="idref" href="#st'':186"><span class="id" title="binder">st''</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:185"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:182"><span class="id" title="variable">pe_st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:181"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st'':186"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c':184"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':183"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:185"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':186"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c'</span> <span class="id" title="var">Hpe</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Hpe</span>; <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span> <span class="id" title="var">Heval</span>;<br/>
&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>, → <span class="id" title="var">H</span> <span class="id" title="keyword">in</span> *; <span class="id" title="var">solve_by_invert</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[]);<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnStatic&nbsp;*)</span> <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">econstructor</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_add"><span class="id" title="lemma">pe_update_update_add</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnDynamic&nbsp;*)</span> <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_remove"><span class="id" title="lemma">pe_update_update_remove</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_Seq&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span>. <span class="id" title="var">eassumption</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_If&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E'IfTrue&nbsp;*)</span> <span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>. <span class="id" title="var">eassumption</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfFalse&nbsp;*)</span> <span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>. <span class="id" title="var">eassumption</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="var">eassumption</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="comment">(*&nbsp;NOTATION&nbsp;:&nbsp;IY&nbsp;--&nbsp;Note&nbsp;:&nbsp;In&nbsp;the&nbsp;PE_AsgnDynamic/If&nbsp;cases,&nbsp;"=<span class="inlinecode"></span> <span class="inlinecode"></span>=&gt;"&nbsp;breaks&nbsp;in&nbsp;a&nbsp;weird<br/>
&nbsp;&nbsp;&nbsp;way.&nbsp;*)</span><br/>
<span class="id" title="keyword">Theorem</span> <a id="pe_com_sound" class="idref" href="#pe_com_sound"><span class="id" title="lemma">pe_com_sound</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="c:187" class="idref" href="#c:187"><span class="id" title="binder">c</span></a> <a id="pe_st:188" class="idref" href="#pe_st:188"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':189" class="idref" href="#pe_st':189"><span class="id" title="binder">pe_st'</span></a> <a id="c':190" class="idref" href="#c':190"><span class="id" title="binder">c'</span></a>, <a class="idref" href="PE.html#c:187"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:188"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c':190"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':189"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:191" class="idref" href="#st:191"><span class="id" title="binder">st</span></a> <a id="st'':192" class="idref" href="#st'':192"><span class="id" title="binder">st''</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c':190"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':189"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:191"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':192"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:191"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:188"><span class="id" title="variable">pe_st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:187"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st'':192"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c'</span> <span class="id" title="var">Hpe</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Hpe</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span> [<span class="id" title="var">st'</span> <span class="id" title="var">Heval</span> <span class="id" title="var">Heq</span>];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; []; <span class="id" title="tactic">subst</span>); <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnStatic&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_add"><span class="id" title="lemma">pe_update_update_add</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_Asgn</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnDynamic&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_remove"><span class="id" title="lemma">pe_update_update_remove</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_Asgn</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_Seq&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>; <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_IfTrue&nbsp;*)</span> <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_IfFalse&nbsp;*)</span> <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_If&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>; <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>7</sub></span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id" title="tactic">eapply</span> <span class="id" title="lemma">ceval_deterministic</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>8</sub></span>; [| <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>]); <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>. <span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfFalse&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>. <span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="tactic">eauto</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
The main theorem. Thanks to David Menendez for this formulation! 
</div>
<div class="code">

<span class="id" title="keyword">Corollary</span> <a id="pe_com_correct" class="idref" href="#pe_com_correct"><span class="id" title="lemma">pe_com_correct</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="c:193" class="idref" href="#c:193"><span class="id" title="binder">c</span></a> <a id="pe_st:194" class="idref" href="#pe_st:194"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':195" class="idref" href="#pe_st':195"><span class="id" title="binder">pe_st'</span></a> <a id="c':196" class="idref" href="#c':196"><span class="id" title="binder">c'</span></a>, <a class="idref" href="PE.html#c:193"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:194"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c':196"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#b4b2897a6a6bcd7183113e5d578cc9c<sub>5</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':195"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:197" class="idref" href="#st:197"><span class="id" title="binder">st</span></a> <a id="st'':198" class="idref" href="#st'':198"><span class="id" title="binder">st''</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:197"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:194"><span class="id" title="variable">pe_st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:193"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st'':198"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">↔</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c':196"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':195"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:197"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#9080f57e2483ed1c9ac1940b94629a9a"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':198"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c'</span> <span class="id" title="var">H</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span>. <span class="id" title="tactic">split</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;*)</span> <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_com_complete"><span class="id" title="lemma">pe_com_complete</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;&lt;-&nbsp;*)</span> <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_com_sound"><span class="id" title="lemma">pe_com_sound</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="var">H</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab485"></a><h1 class="section">Partial Evaluation of Loops</h1>

<div class="paragraph"> </div>

 It may seem straightforward at first glance to extend the partial
    evaluation relation <span class="inlinecode"><span class="id" title="var">pe_com</span></span> above to loops.  Indeed, many loops
    are easy to deal with.  Considered this repeated-squaring loop,
    for example:
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">while</span> 1 ≤ <span class="id" title="var">X</span> <span class="id" title="tactic">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> × <span class="id" title="var">Y</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := <span class="id" title="var">X</span> - 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span>
</span>    If we know neither <span class="inlinecode"><span class="id" title="var">X</span></span> nor <span class="inlinecode"><span class="id" title="var">Y</span></span> statically, then the entire loop is
    dynamic and the residual command should be the same.  If we know
    <span class="inlinecode"><span class="id" title="var">X</span></span> but not <span class="inlinecode"><span class="id" title="var">Y</span></span>, then the loop can be unrolled all the way and the
    residual command should be, for example,
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> × <span class="id" title="var">Y</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> × <span class="id" title="var">Y</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> × <span class="id" title="var">Y</span>
</span>    if <span class="inlinecode"><span class="id" title="var">X</span></span> is initially <span class="inlinecode">3</span> (and finally <span class="inlinecode">0</span>).  In general, a loop is
    easy to partially evaluate if the final partial state of the loop
    body is equal to the initial state, or if its guard condition is
    static.

<div class="paragraph"> </div>

    But there are other loops for which it is hard to express the
    residual program we want in Imp.  For example, take this program
    for checking whether <span class="inlinecode"><span class="id" title="var">Y</span></span> is even or odd:
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 0;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">while</span> 1 ≤ <span class="id" title="var">Y</span> <span class="id" title="tactic">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> - 1 ;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 1 - <span class="id" title="var">X</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span>
</span>    The value of <span class="inlinecode"><span class="id" title="var">X</span></span> alternates between <span class="inlinecode">0</span> and <span class="inlinecode">1</span> during the loop.
    Ideally, we would like to unroll this loop, not all the way but
    <i>two-fold</i>, into something like
<br/>
<span class="inlinecode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">while</span> 1 ≤ <span class="id" title="var">Y</span> <span class="id" title="tactic">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> - 1;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">if</span> 1 ≤ <span class="id" title="var">Y</span> <span class="id" title="keyword">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Y</span> := <span class="id" title="var">Y</span> - 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">else</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 1; <span class="id" title="var">EXIT</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">X</span> := 0
</span>    Unfortunately, there is no <span class="inlinecode"><span class="id" title="var">EXIT</span></span> command in Imp.  Without
    extending the range of control structures available in our
    language, the best we can do is to repeat loop-guard tests or add
    flag variables.  Neither option is terribly attractive.

<div class="paragraph"> </div>

    Still, as a digression, below is an attempt at performing partial
    evaluation on Imp commands.  We add one more command argument
    <span class="inlinecode"><span class="id" title="var">c''</span></span> to the <span class="inlinecode"><span class="id" title="var">pe_com</span></span> relation, which keeps track of a loop to
    roll up. 
</div>
<div class="code">

<span class="id" title="keyword">Module</span> <a id="Loop" class="idref" href="#Loop"><span class="id" title="module">Loop</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Reserved Notation</span> &quot;c<sub>1</sub> '/' st '==&gt;' c<sub>1</sub>' '/' st' '/' c''"<br/>
&nbsp;&nbsp;(<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 40, <span class="id" title="var">st</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">c<sub>1</sub>'</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">st'</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Inductive</span> <a id="Loop.pe_com" class="idref" href="#Loop.pe_com"><span class="id" title="inductive">pe_com</span></a> : <span class="id" title="inductive">com</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="inductive">com</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="inductive">com</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="Loop.PE_Skip" class="idref" href="#Loop.PE_Skip"><span class="id" title="constructor">PE_Skip</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:201" class="idref" href="#pe_st:201"><span class="id" title="binder">pe_st</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:201"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:201"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <a id="Loop.PE_AsgnStatic" class="idref" href="#Loop.PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:202" class="idref" href="#pe_st:202"><span class="id" title="binder">pe_st</span></a> <a id="a<sub>1</sub>:203" class="idref" href="#a<sub>1</sub>:203"><span class="id" title="binder">a<sub>1</sub></span></a> (<a id="n<sub>1</sub>:204" class="idref" href="#n<sub>1</sub>:204"><span class="id" title="binder">n<sub>1</sub></span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>) <a id="l:205" class="idref" href="#l:205"><span class="id" title="binder">l</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:202"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#a<sub>1</sub>:203"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <a class="idref" href="PE.html#n<sub>1</sub>:204"><span class="id" title="variable">n<sub>1</sub></span></a> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span> <a class="idref" href="PE.html#l:205"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>:203"><span class="id" title="variable">a<sub>1</sub></span></a> <span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:202"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_add"><span class="id" title="definition">pe_add</span></a> <a class="idref" href="PE.html#pe_st:202"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#l:205"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#n<sub>1</sub>:204"><span class="id" title="variable">n<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <a id="Loop.PE_AsgnDynamic" class="idref" href="#Loop.PE_AsgnDynamic"><span class="id" title="constructor">PE_AsgnDynamic</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:206" class="idref" href="#pe_st:206"><span class="id" title="binder">pe_st</span></a> <a id="a<sub>1</sub>:207" class="idref" href="#a<sub>1</sub>:207"><span class="id" title="binder">a<sub>1</sub></span></a> <a id="a<sub>1</sub>':208" class="idref" href="#a<sub>1</sub>':208"><span class="id" title="binder">a<sub>1</sub>'</span></a> <a id="l:209" class="idref" href="#l:209"><span class="id" title="binder">l</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:206"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#a<sub>1</sub>:207"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#a<sub>1</sub>':208"><span class="id" title="variable">a<sub>1</sub>'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><span class="id" title="keyword">∀</span> <a id="n:210" class="idref" href="#n:210"><span class="id" title="binder">n</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>, <a class="idref" href="PE.html#a<sub>1</sub>':208"><span class="id" title="variable">a<sub>1</sub>'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <a class="idref" href="PE.html#n:210"><span class="id" title="variable">n</span></a> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#l:209"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>:207"><span class="id" title="variable">a<sub>1</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:206"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#l:209"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>':208"><span class="id" title="variable">a<sub>1</sub>'</span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:206"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#l:209"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <a id="Loop.PE_Seq" class="idref" href="#Loop.PE_Seq"><span class="id" title="constructor">PE_Seq</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:211" class="idref" href="#pe_st:211"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':212" class="idref" href="#pe_st':212"><span class="id" title="binder">pe_st'</span></a> <a id="pe_st'':213" class="idref" href="#pe_st'':213"><span class="id" title="binder">pe_st''</span></a> <a id="c<sub>1</sub>:214" class="idref" href="#c<sub>1</sub>:214"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:215" class="idref" href="#c<sub>2</sub>:215"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>1</sub>':216" class="idref" href="#c<sub>1</sub>':216"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':217" class="idref" href="#c<sub>2</sub>':217"><span class="id" title="binder">c<sub>2</sub>'</span></a> <a id="c'':218" class="idref" href="#c'':218"><span class="id" title="binder">c''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:214"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:211"><span class="id" title="variable">pe_st</span></a>  <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':216"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':212"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:215"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':212"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':217"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':213"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':218"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#c<sub>1</sub>:214"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>:215"><span class="id" title="variable">c<sub>2</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:211"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#c<sub>1</sub>':216"><span class="id" title="variable">c<sub>1</sub>'</span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>':217"><span class="id" title="variable">c<sub>2</sub>'</span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':213"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':218"><span class="id" title="variable">c''</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.PE_IfTrue" class="idref" href="#Loop.PE_IfTrue"><span class="id" title="constructor">PE_IfTrue</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:219" class="idref" href="#pe_st:219"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':220" class="idref" href="#pe_st':220"><span class="id" title="binder">pe_st'</span></a> <a id="b<sub>1</sub>:221" class="idref" href="#b<sub>1</sub>:221"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:222" class="idref" href="#c<sub>1</sub>:222"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:223" class="idref" href="#c<sub>2</sub>:223"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>1</sub>':224" class="idref" href="#c<sub>1</sub>':224"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c'':225" class="idref" href="#c'':225"><span class="id" title="binder">c''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:219"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:221"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:222"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:219"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':224"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':220"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':225"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:221"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:222"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:223"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:219"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':224"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':220"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':225"><span class="id" title="variable">c''</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.PE_IfFalse" class="idref" href="#Loop.PE_IfFalse"><span class="id" title="constructor">PE_IfFalse</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:226" class="idref" href="#pe_st:226"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':227" class="idref" href="#pe_st':227"><span class="id" title="binder">pe_st'</span></a> <a id="b<sub>1</sub>:228" class="idref" href="#b<sub>1</sub>:228"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:229" class="idref" href="#c<sub>1</sub>:229"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:230" class="idref" href="#c<sub>2</sub>:230"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>2</sub>':231" class="idref" href="#c<sub>2</sub>':231"><span class="id" title="binder">c<sub>2</sub>'</span></a> <a id="c'':232" class="idref" href="#c'':232"><span class="id" title="binder">c''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:226"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:228"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:230"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:226"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':231"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':227"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':232"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:228"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:229"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:230"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:226"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':231"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':227"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':232"><span class="id" title="variable">c''</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.PE_If" class="idref" href="#Loop.PE_If"><span class="id" title="constructor">PE_If</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:233" class="idref" href="#pe_st:233"><span class="id" title="binder">pe_st</span></a> <a id="pe_st<sub>1</sub>:234" class="idref" href="#pe_st<sub>1</sub>:234"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:235" class="idref" href="#pe_st<sub>2</sub>:235"><span class="id" title="binder">pe_st<sub>2</sub></span></a> <a id="b<sub>1</sub>:236" class="idref" href="#b<sub>1</sub>:236"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:237" class="idref" href="#c<sub>1</sub>:237"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:238" class="idref" href="#c<sub>2</sub>:238"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="c<sub>1</sub>':239" class="idref" href="#c<sub>1</sub>':239"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':240" class="idref" href="#c<sub>2</sub>':240"><span class="id" title="binder">c<sub>2</sub>'</span></a> <a id="c'':241" class="idref" href="#c'':241"><span class="id" title="binder">c''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:233"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:236"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:233"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:236"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:237"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:233"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':239"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:234"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':241"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:238"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:233"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':240"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:235"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':241"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:236"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:237"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:238"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:233"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:233"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:236"><span class="id" title="variable">b<sub>1</sub></span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>':239"><span class="id" title="variable">c<sub>1</sub>'</span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:234"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <span class="id" title="notation">(</span><a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:234"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:235"><span class="id" title="variable">pe_st<sub>2</sub></span></a><span class="id" title="notation">)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>':240"><span class="id" title="variable">c<sub>2</sub>'</span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:235"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <span class="id" title="notation">(</span><a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:234"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:235"><span class="id" title="variable">pe_st<sub>2</sub></span></a><span class="id" title="notation">)</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:234"><span class="id" title="variable">pe_st<sub>1</sub></span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:234"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:235"><span class="id" title="variable">pe_st<sub>2</sub></span></a>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':241"><span class="id" title="variable">c''</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.PE_WhileFalse" class="idref" href="#Loop.PE_WhileFalse"><span class="id" title="constructor">PE_WhileFalse</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:242" class="idref" href="#pe_st:242"><span class="id" title="binder">pe_st</span></a> <a id="b<sub>1</sub>:243" class="idref" href="#b<sub>1</sub>:243"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:244" class="idref" href="#c<sub>1</sub>:244"><span class="id" title="binder">c<sub>1</sub></span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:242"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:243"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="constructor">BFalse</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:243"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:244"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:242"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:242"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <a id="Loop.PE_WhileTrue" class="idref" href="#Loop.PE_WhileTrue"><span class="id" title="constructor">PE_WhileTrue</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:245" class="idref" href="#pe_st:245"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':246" class="idref" href="#pe_st':246"><span class="id" title="binder">pe_st'</span></a> <a id="pe_st'':247" class="idref" href="#pe_st'':247"><span class="id" title="binder">pe_st''</span></a> <a id="b<sub>1</sub>:248" class="idref" href="#b<sub>1</sub>:248"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:249" class="idref" href="#c<sub>1</sub>:249"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>1</sub>':250" class="idref" href="#c<sub>1</sub>':250"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':251" class="idref" href="#c<sub>2</sub>':251"><span class="id" title="binder">c<sub>2</sub>'</span></a> <a id="c<sub>2</sub>'':252" class="idref" href="#c<sub>2</sub>'':252"><span class="id" title="binder">c<sub>2</sub>''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:245"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:248"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:249"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:245"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':250"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':246"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:248"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:249"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':246"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':251"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':247"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c<sub>2</sub>'':252"><span class="id" title="variable">c<sub>2</sub>''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:245"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':247"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:248"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:249"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:245"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#c<sub>1</sub>':250"><span class="id" title="variable">c<sub>1</sub>'</span></a><span class="id" title="notation">;</span><a class="idref" href="PE.html#c<sub>2</sub>':251"><span class="id" title="variable">c<sub>2</sub>'</span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':247"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c<sub>2</sub>'':252"><span class="id" title="variable">c<sub>2</sub>''</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.PE_While" class="idref" href="#Loop.PE_While"><span class="id" title="constructor">PE_While</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:253" class="idref" href="#pe_st:253"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':254" class="idref" href="#pe_st':254"><span class="id" title="binder">pe_st'</span></a> <a id="pe_st'':255" class="idref" href="#pe_st'':255"><span class="id" title="binder">pe_st''</span></a> <a id="b<sub>1</sub>:256" class="idref" href="#b<sub>1</sub>:256"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:257" class="idref" href="#c<sub>1</sub>:257"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>1</sub>':258" class="idref" href="#c<sub>1</sub>':258"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':259" class="idref" href="#c<sub>2</sub>':259"><span class="id" title="binder">c<sub>2</sub>'</span></a> <a id="c<sub>2</sub>'':260" class="idref" href="#c<sub>2</sub>'':260"><span class="id" title="binder">c<sub>2</sub>''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:256"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:256"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:257"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':258"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':254"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:256"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:257"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':254"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':259"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':255"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c<sub>2</sub>'':260"><span class="id" title="variable">c<sub>2</sub>''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':255"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c<sub>2</sub>'':260"><span class="id" title="variable">c<sub>2</sub>''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f031fe1957c4a4a8e217aa46af2b4e<sub>25</sub>"><span class="id" title="notation">∨</span></a> <a class="idref" href="PE.html#c<sub>2</sub>'':260"><span class="id" title="variable">c<sub>2</sub>''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:256"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:257"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:256"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:257"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:256"><span class="id" title="variable">b<sub>1</sub></span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>':258"><span class="id" title="variable">c<sub>1</sub>'</span></a><span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>':259"><span class="id" title="variable">c<sub>2</sub>'</span></a><span class="id" title="notation">;</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st'':255"><span class="id" title="variable">pe_st''</span></a> <span class="id" title="notation">(</span><a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':255"><span class="id" title="variable">pe_st''</span></a><span class="id" title="notation">)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <a class="idref" href="PE.html#assign"><span class="id" title="definition">assign</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <span class="id" title="notation">(</span><a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':255"><span class="id" title="variable">pe_st''</span></a><span class="id" title="notation">)</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_removes"><span class="id" title="definition">pe_removes</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> (<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:253"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':255"><span class="id" title="variable">pe_st''</span></a>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c<sub>2</sub>'':260"><span class="id" title="variable">c<sub>2</sub>''</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.PE_WhileFixedEnd" class="idref" href="#Loop.PE_WhileFixedEnd"><span class="id" title="constructor">PE_WhileFixedEnd</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:261" class="idref" href="#pe_st:261"><span class="id" title="binder">pe_st</span></a> <a id="b<sub>1</sub>:262" class="idref" href="#b<sub>1</sub>:262"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:263" class="idref" href="#c<sub>1</sub>:263"><span class="id" title="binder">c<sub>1</sub></span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:261"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:262"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:262"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:263"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:261"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:261"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:262"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:263"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;| <a id="Loop.PE_WhileFixedLoop" class="idref" href="#Loop.PE_WhileFixedLoop"><span class="id" title="constructor">PE_WhileFixedLoop</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:264" class="idref" href="#pe_st:264"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':265" class="idref" href="#pe_st':265"><span class="id" title="binder">pe_st'</span></a> <a id="pe_st'':266" class="idref" href="#pe_st'':266"><span class="id" title="binder">pe_st''</span></a> <a id="b<sub>1</sub>:267" class="idref" href="#b<sub>1</sub>:267"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:268" class="idref" href="#c<sub>1</sub>:268"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>1</sub>':269" class="idref" href="#c<sub>1</sub>':269"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':270" class="idref" href="#c<sub>2</sub>':270"><span class="id" title="binder">c<sub>2</sub>'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:264"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:267"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:268"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:264"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':269"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':265"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:267"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:268"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':265"><span class="id" title="variable">pe_st'</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':270"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':266"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:267"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:268"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:264"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':266"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:267"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:268"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:264"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <span class="id" title="notation">true</span> <span class="id" title="notation">do</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:264"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">(*&nbsp;Because&nbsp;we&nbsp;have&nbsp;an&nbsp;infinite&nbsp;loop,&nbsp;we&nbsp;should&nbsp;actually<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start&nbsp;to&nbsp;throw&nbsp;away&nbsp;the&nbsp;rest&nbsp;of&nbsp;the&nbsp;program:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(while&nbsp;b<sub>1</sub>&nbsp;do&nbsp;c<sub>1</sub>&nbsp;end)&nbsp;/&nbsp;pe_st<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;==&gt;&nbsp;skip&nbsp;/&nbsp;pe_st&nbsp;/&nbsp;(while&nbsp;BTrue&nbsp;do&nbsp;skip&nbsp;end)&nbsp;*)</span><br/>
&nbsp;&nbsp;| <a id="Loop.PE_WhileFixed" class="idref" href="#Loop.PE_WhileFixed"><span class="id" title="constructor">PE_WhileFixed</span></a> : <span class="id" title="keyword">∀</span> <a id="pe_st:271" class="idref" href="#pe_st:271"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':272" class="idref" href="#pe_st':272"><span class="id" title="binder">pe_st'</span></a> <a id="pe_st'':273" class="idref" href="#pe_st'':273"><span class="id" title="binder">pe_st''</span></a> <a id="b<sub>1</sub>:274" class="idref" href="#b<sub>1</sub>:274"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:275" class="idref" href="#c<sub>1</sub>:275"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>1</sub>':276" class="idref" href="#c<sub>1</sub>':276"><span class="id" title="binder">c<sub>1</sub>'</span></a> <a id="c<sub>2</sub>':277" class="idref" href="#c<sub>2</sub>':277"><span class="id" title="binder">c<sub>2</sub>'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:274"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">false</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:274"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;&gt;'_x"><span class="id" title="notation">≠</span></a> <span class="id" title="notation">&lt;{</span> <span class="id" title="notation">true</span> <span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:275"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>1</sub>':276"><span class="id" title="variable">c<sub>1</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':272"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:274"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:275"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':272"><span class="id" title="variable">pe_st'</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c<sub>2</sub>':277"><span class="id" title="variable">c<sub>2</sub>'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st'':273"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:274"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:275"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#pe_st'':273"><span class="id" title="variable">pe_st''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:274"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:275"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:274"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>':276"><span class="id" title="variable">c<sub>1</sub>'</span></a><span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>':277"><span class="id" title="variable">c<sub>2</sub>'</span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:271"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span><br/>
<br/>
&nbsp;&nbsp;<span class="id" title="keyword">where</span> <a id="7120073eb86390e07bb1d827e01dd845" class="idref" href="#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">&quot;</span></a>c<sub>1</sub> '/' st '==&gt;' c<sub>1</sub>' '/' st' '/' c''" := (<a class="idref" href="PE.html#pe_com:200"><span class="id" title="inductive">pe_com</span></a> <span class="id" title="var">c<sub>1</sub></span> <span class="id" title="var">st</span> <span class="id" title="var">c<sub>1</sub>'</span> <span class="id" title="var">st'</span> <span class="id" title="var">c''</span>).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Local Hint Constructors</span> <a class="idref" href="PE.html#pe_com"><span class="id" title="inductive">pe_com</span></a> : <span class="id" title="var">core</span>.<br/>
</div>

<div class="doc">
<a id="lab486"></a><h2 class="section">Examples</h2>

</div>
<div class="code">

<span class="id" title="keyword">Ltac</span> <span class="id" title="var">step</span> <span class="id" title="var">i</span> :=<br/>
&nbsp;&nbsp;(<span class="id" title="tactic">eapply</span> <span class="id" title="var">i</span>; <span class="id" title="tactic">intuition</span> <span class="id" title="tactic">eauto</span>; <span class="id" title="tactic">try</span> <span class="id" title="var">solve_by_invert</span>);<br/>
&nbsp;&nbsp;<span class="id" title="tactic">repeat</span> (<span class="id" title="tactic">try</span> <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>; <span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">reflexivity</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_AsgnDynamic"><span class="id" title="constructor">PE_AsgnDynamic</span></a>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">reflexivity</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="tactic">intuition</span> <span class="id" title="tactic">eauto</span>; <span class="id" title="var">solve_by_invert</span>])).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Definition</span> <a id="Loop.square_loop" class="idref" href="#Loop.square_loop"><span class="id" title="definition">square_loop</span></a>: <span class="id" title="inductive">com</span> :=<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> 1 <span class="id" title="notation">≤</span> <span class="id" title="definition">X</span> <span class="id" title="notation">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">×</span> <span class="id" title="definition">Y</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">X</span> <span class="id" title="notation">-</span> 1<br/>
&nbsp;&nbsp;<span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="Loop.pe_loop_example1" class="idref" href="#Loop.pe_loop_example1"><span class="id" title="definition">pe_loop_example1</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#Loop.square_loop"><span class="id" title="definition">square_loop</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> 1 <span class="id" title="notation">≤</span> <span class="id" title="definition">X</span> <span class="id" title="notation">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">×</span> <span class="id" title="definition">Y</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">X</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">)</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f_equal2"><span class="id" title="lemma">f_equal2</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">f</span> := <span class="id" title="keyword">fun</span> <a id="c:286" class="idref" href="#c:286"><span class="id" title="binder">c</span></a> <a id="st:287" class="idref" href="#st:287"><span class="id" title="binder">st</span></a> ⇒ <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c:278"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:279"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>).<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFixed"><span class="id" title="constructor">PE_WhileFixed</span></a>. <span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFixedEnd"><span class="id" title="constructor">PE_WhileFixedEnd</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="Loop.pe_loop_example2" class="idref" href="#Loop.pe_loop_example2"><span class="id" title="definition">pe_loop_example2</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 3<span class="id" title="notation">;</span> <a class="idref" href="PE.html#Loop.square_loop"><span class="id" title="definition">square_loop</span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">×</span> <span class="id" title="definition">Y</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><span class="id" title="notation">)</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">×</span> <span class="id" title="definition">Y</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><span class="id" title="notation">)</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="definition">Y</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">×</span> <span class="id" title="definition">Y</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><span class="id" title="notation">)</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>0<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f_equal2"><span class="id" title="lemma">f_equal2</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">f</span> := <span class="id" title="keyword">fun</span> <a id="c:296" class="idref" href="#c:296"><span class="id" title="binder">c</span></a> <a id="st:297" class="idref" href="#st:297"><span class="id" title="binder">st</span></a> ⇒ <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c:288"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:289"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>).<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileTrue"><span class="id" title="constructor">PE_WhileTrue</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileTrue"><span class="id" title="constructor">PE_WhileTrue</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileTrue"><span class="id" title="constructor">PE_WhileTrue</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFalse"><span class="id" title="constructor">PE_WhileFalse</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="Loop.pe_loop_example3" class="idref" href="#Loop.pe_loop_example3"><span class="id" title="definition">pe_loop_example3</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="definition">Z</span> <span class="id" title="notation">:=</span> 3<span class="id" title="notation">;</span> <span class="id" title="definition">subtract_slowly</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">if</span> <span class="id" title="notation">¬</span><span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">=</span> 0<span class="id" title="notation">)</span> <span class="id" title="notation">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">X</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">)</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">if</span> <span class="id" title="notation">¬</span><span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">=</span> 0<span class="id" title="notation">)</span> <span class="id" title="notation">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">X</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">)</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">if</span> <span class="id" title="notation">¬</span><span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">=</span> 0<span class="id" title="notation">)</span> <span class="id" title="notation">then</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">X</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">)</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">while</span> <span class="id" title="notation">¬</span><span class="id" title="notation">(</span><span class="id" title="definition">X</span> <span class="id" title="notation">=</span> 0<span class="id" title="notation">)</span> <span class="id" title="notation">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">(</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> <span class="id" title="definition">X</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">)</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">end</span><span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">:=</span> 0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">:=</span> 1 <span class="id" title="notation">end</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">:=</span> 2 <span class="id" title="notation">end</span><span class="id" title="notation">;</span> <span class="id" title="notation">skip</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">else</span> <span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="definition">Z</span> <span class="id" title="notation">:=</span> 3 <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f_equal2"><span class="id" title="lemma">f_equal2</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">f</span> := <span class="id" title="keyword">fun</span> <a id="c:306" class="idref" href="#c:306"><span class="id" title="binder">c</span></a> <a id="st:307" class="idref" href="#st:307"><span class="id" title="binder">st</span></a> ⇒ <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c:298"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:299"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>).<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_While"><span class="id" title="constructor">PE_While</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_While"><span class="id" title="constructor">PE_While</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_While"><span class="id" title="constructor">PE_While</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFixed"><span class="id" title="constructor">PE_WhileFixed</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFixedEnd"><span class="id" title="constructor">PE_WhileFixedEnd</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="Loop.pe_loop_example4" class="idref" href="#Loop.pe_loop_example4"><span class="id" title="definition">pe_loop_example4</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 0<span class="id" title="notation">;</span><br/>
&nbsp;&nbsp;&nbsp;<span class="id" title="notation">while</span> <span class="id" title="definition">X</span> <span class="id" title="notation">≤</span> 2 <span class="id" title="notation">do</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">X</span> <span class="id" title="notation">:=</span> 1 <span class="id" title="notation">-</span> <span class="id" title="definition">X</span><br/>
&nbsp;&nbsp;&nbsp;<span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">;</span> <span class="id" title="notation">while</span> <span class="id" title="notation">true</span> <span class="id" title="notation">do</span> <span class="id" title="notation">skip</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>0<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f_equal2"><span class="id" title="lemma">f_equal2</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">f</span> := <span class="id" title="keyword">fun</span> <a id="c:316" class="idref" href="#c:316"><span class="id" title="binder">c</span></a> <a id="st:317" class="idref" href="#st:317"><span class="id" title="binder">st</span></a> ⇒ <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="var">_</span> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c:308"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:309"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span>).<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_Seq"><span class="id" title="constructor">PE_Seq</span></a>. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.PE_AsgnStatic"><span class="id" title="constructor">PE_AsgnStatic</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFixedLoop"><span class="id" title="constructor">PE_WhileFixedLoop</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileTrue"><span class="id" title="constructor">PE_WhileTrue</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="var">step</span> <a class="idref" href="PE.html#Loop.PE_WhileFixedEnd"><span class="id" title="constructor">PE_WhileFixedEnd</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab487"></a><h2 class="section">Correctness</h2>

<div class="paragraph"> </div>

 Because this partial evaluator can unroll a loop n-fold where n is
    a (finite) integer greater than one, in order to show it correct
    we need to perform induction not structurally on dynamic
    evaluation but on the number of times dynamic evaluation enters a
    loop body. 
</div>
<div class="code">

<span class="id" title="keyword">Reserved Notation</span> &quot;c<sub>1</sub> '/' st '==&gt;' st' '#' n"<br/>
&nbsp;&nbsp;(<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 40, <span class="id" title="var">st</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">st'</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Inductive</span> <a id="Loop.ceval_count" class="idref" href="#Loop.ceval_count"><span class="id" title="inductive">ceval_count</span></a> : <span class="id" title="inductive">com</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="definition">state</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="definition">state</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="Loop.E'Skip" class="idref" href="#Loop.E'Skip"><span class="id" title="constructor">E'Skip</span></a> : <span class="id" title="keyword">∀</span> <a id="st:320" class="idref" href="#st:320"><span class="id" title="binder">st</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:320"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st:320"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> 0<br/>
&nbsp;&nbsp;| <a id="Loop.E'Asgn" class="idref" href="#Loop.E'Asgn"><span class="id" title="constructor">E'Asgn</span></a>  : <span class="id" title="keyword">∀</span> <a id="st:321" class="idref" href="#st:321"><span class="id" title="binder">st</span></a> <a id="a<sub>1</sub>:322" class="idref" href="#a<sub>1</sub>:322"><span class="id" title="binder">a<sub>1</sub></span></a> <a id="n:323" class="idref" href="#n:323"><span class="id" title="binder">n</span></a> <a id="l:324" class="idref" href="#l:324"><span class="id" title="binder">l</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">aeval</span> <a class="idref" href="PE.html#st:321"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#a<sub>1</sub>:322"><span class="id" title="variable">a<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#n:323"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#l:324"><span class="id" title="variable">l</span></a> <span class="id" title="notation">:=</span> <a class="idref" href="PE.html#a<sub>1</sub>:322"><span class="id" title="variable">a<sub>1</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:321"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">(</span></a><span class="id" title="definition">t_update</span> <a class="idref" href="PE.html#st:321"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#l:324"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#n:323"><span class="id" title="variable">n</span></a><a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">)</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> 0<br/>
&nbsp;&nbsp;| <a id="Loop.E'Seq" class="idref" href="#Loop.E'Seq"><span class="id" title="constructor">E'Seq</span></a> : <span class="id" title="keyword">∀</span> <a id="c<sub>1</sub>:325" class="idref" href="#c<sub>1</sub>:325"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:326" class="idref" href="#c<sub>2</sub>:326"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="st:327" class="idref" href="#st:327"><span class="id" title="binder">st</span></a> <a id="st':328" class="idref" href="#st':328"><span class="id" title="binder">st'</span></a> <a id="st'':329" class="idref" href="#st'':329"><span class="id" title="binder">st''</span></a> <a id="n<sub>1</sub>:330" class="idref" href="#n<sub>1</sub>:330"><span class="id" title="binder">n<sub>1</sub></span></a> <a id="n<sub>2</sub>:331" class="idref" href="#n<sub>2</sub>:331"><span class="id" title="binder">n<sub>2</sub></span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:325"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:327"><span class="id" title="variable">st</span></a>  <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':328"><span class="id" title="variable">st'</span></a>  <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n<sub>1</sub>:330"><span class="id" title="variable">n<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:326"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st':328"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':329"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n<sub>2</sub>:331"><span class="id" title="variable">n<sub>2</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><a class="idref" href="PE.html#c<sub>1</sub>:325"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">;</span> <a class="idref" href="PE.html#c<sub>2</sub>:326"><span class="id" title="variable">c<sub>2</sub></span></a><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:327"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':329"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#n<sub>1</sub>:330"><span class="id" title="variable">n<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#0dacc1786c5ba797d47dd85006231633"><span class="id" title="notation">+</span></a> <a class="idref" href="PE.html#n<sub>2</sub>:331"><span class="id" title="variable">n<sub>2</sub></span></a><a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.E'IfTrue" class="idref" href="#Loop.E'IfTrue"><span class="id" title="constructor">E'IfTrue</span></a> : <span class="id" title="keyword">∀</span> <a id="st:332" class="idref" href="#st:332"><span class="id" title="binder">st</span></a> <a id="st':333" class="idref" href="#st':333"><span class="id" title="binder">st'</span></a> <a id="b<sub>1</sub>:334" class="idref" href="#b<sub>1</sub>:334"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:335" class="idref" href="#c<sub>1</sub>:335"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:336" class="idref" href="#c<sub>2</sub>:336"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="n:337" class="idref" href="#n:337"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">beval</span> <a class="idref" href="PE.html#st:332"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:334"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">true</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:335"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:332"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':333"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:337"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:334"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:335"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:336"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:332"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':333"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:337"><span class="id" title="variable">n</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.E'IfFalse" class="idref" href="#Loop.E'IfFalse"><span class="id" title="constructor">E'IfFalse</span></a> : <span class="id" title="keyword">∀</span> <a id="st:338" class="idref" href="#st:338"><span class="id" title="binder">st</span></a> <a id="st':339" class="idref" href="#st':339"><span class="id" title="binder">st'</span></a> <a id="b<sub>1</sub>:340" class="idref" href="#b<sub>1</sub>:340"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:341" class="idref" href="#c<sub>1</sub>:341"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="c<sub>2</sub>:342" class="idref" href="#c<sub>2</sub>:342"><span class="id" title="binder">c<sub>2</sub></span></a> <a id="n:343" class="idref" href="#n:343"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">beval</span> <a class="idref" href="PE.html#st:338"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:340"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">false</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>2</sub>:342"><span class="id" title="variable">c<sub>2</sub></span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:338"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':339"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:343"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">if</span> <a class="idref" href="PE.html#b<sub>1</sub>:340"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">then</span> <a class="idref" href="PE.html#c<sub>1</sub>:341"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">else</span> <a class="idref" href="PE.html#c<sub>2</sub>:342"><span class="id" title="variable">c<sub>2</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:338"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':339"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:343"><span class="id" title="variable">n</span></a><br/>
&nbsp;&nbsp;| <a id="Loop.E'WhileFalse" class="idref" href="#Loop.E'WhileFalse"><span class="id" title="constructor">E'WhileFalse</span></a> : <span class="id" title="keyword">∀</span> <a id="b<sub>1</sub>:344" class="idref" href="#b<sub>1</sub>:344"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="st:345" class="idref" href="#st:345"><span class="id" title="binder">st</span></a> <a id="c<sub>1</sub>:346" class="idref" href="#c<sub>1</sub>:346"><span class="id" title="binder">c<sub>1</sub></span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">beval</span> <a class="idref" href="PE.html#st:345"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:344"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">false</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:344"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:346"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:345"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st:345"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> 0<br/>
&nbsp;&nbsp;| <a id="Loop.E'WhileTrue" class="idref" href="#Loop.E'WhileTrue"><span class="id" title="constructor">E'WhileTrue</span></a> : <span class="id" title="keyword">∀</span> <a id="st:347" class="idref" href="#st:347"><span class="id" title="binder">st</span></a> <a id="st':348" class="idref" href="#st':348"><span class="id" title="binder">st'</span></a> <a id="st'':349" class="idref" href="#st'':349"><span class="id" title="binder">st''</span></a> <a id="b<sub>1</sub>:350" class="idref" href="#b<sub>1</sub>:350"><span class="id" title="binder">b<sub>1</sub></span></a> <a id="c<sub>1</sub>:351" class="idref" href="#c<sub>1</sub>:351"><span class="id" title="binder">c<sub>1</sub></span></a> <a id="n<sub>1</sub>:352" class="idref" href="#n<sub>1</sub>:352"><span class="id" title="binder">n<sub>1</sub></span></a> <a id="n<sub>2</sub>:353" class="idref" href="#n<sub>2</sub>:353"><span class="id" title="binder">n<sub>2</sub></span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="definition">beval</span> <a class="idref" href="PE.html#st:347"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#b<sub>1</sub>:350"><span class="id" title="variable">b<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">true</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c<sub>1</sub>:351"><span class="id" title="variable">c<sub>1</sub></span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:347"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':348"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n<sub>1</sub>:352"><span class="id" title="variable">n<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:350"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:351"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st':348"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':349"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n<sub>2</sub>:353"><span class="id" title="variable">n<sub>2</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#b<sub>1</sub>:350"><span class="id" title="variable">b<sub>1</sub></span></a> <span class="id" title="notation">do</span> <a class="idref" href="PE.html#c<sub>1</sub>:351"><span class="id" title="variable">c<sub>1</sub></span></a> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:347"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':349"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#S"><span class="id" title="constructor">S</span></a> (<a class="idref" href="PE.html#n<sub>1</sub>:352"><span class="id" title="variable">n<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#0dacc1786c5ba797d47dd85006231633"><span class="id" title="notation">+</span></a> <a class="idref" href="PE.html#n<sub>2</sub>:353"><span class="id" title="variable">n<sub>2</sub></span></a>)<br/>
<br/>
&nbsp;&nbsp;<span class="id" title="keyword">where</span> <a id="393ab9c73cfe2dca7780259f226e53a<sub>7</sub>" class="idref" href="#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">&quot;</span></a>c<sub>1</sub> '/' st '==&gt;' st' # n" := (<a class="idref" href="PE.html#ceval_count:319"><span class="id" title="inductive">ceval_count</span></a> <span class="id" title="var">c<sub>1</sub></span> <span class="id" title="var">st</span> <span class="id" title="var">st'</span> <span class="id" title="var">n</span>).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Local Hint Constructors</span> <a class="idref" href="PE.html#ceval_count"><span class="id" title="inductive">ceval_count</span></a> : <span class="id" title="var">core</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="Loop.ceval_count_complete" class="idref" href="#Loop.ceval_count_complete"><span class="id" title="lemma">ceval_count_complete</span></a>: <span class="id" title="keyword">∀</span> <a id="c:354" class="idref" href="#c:354"><span class="id" title="binder">c</span></a> <a id="st:355" class="idref" href="#st:355"><span class="id" title="binder">st</span></a> <a id="st':356" class="idref" href="#st':356"><span class="id" title="binder">st'</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#st:355"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:354"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st':356"><span class="id" title="variable">st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#a883bdd010993579f99d60b3775bcf54"><span class="id" title="notation">∃</span></a> <a id="n:357" class="idref" href="#n:357"><span class="id" title="binder">n</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#a883bdd010993579f99d60b3775bcf54"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#c:354"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:355"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':356"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:357"><span class="id" title="variable">n</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">st</span> <span class="id" title="var">st'</span> <span class="id" title="var">Heval</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Heval</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">IHHeval1</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">IHHeval2</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">IHHeval</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eauto</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="Loop.ceval_count_sound" class="idref" href="#Loop.ceval_count_sound"><span class="id" title="lemma">ceval_count_sound</span></a>: <span class="id" title="keyword">∀</span> <a id="c:358" class="idref" href="#c:358"><span class="id" title="binder">c</span></a> <a id="st:359" class="idref" href="#st:359"><span class="id" title="binder">st</span></a> <a id="st':360" class="idref" href="#st':360"><span class="id" title="binder">st'</span></a> <a id="n:361" class="idref" href="#n:361"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#c:358"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:359"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st':360"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:361"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#st:359"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:358"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st':360"><span class="id" title="variable">st'</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">st</span> <span class="id" title="var">st'</span> <span class="id" title="var">n</span> <span class="id" title="var">Heval</span>. <span class="id" title="tactic">induction</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">eauto</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="Loop.pe_compare_nil_lookup" class="idref" href="#Loop.pe_compare_nil_lookup"><span class="id" title="lemma">pe_compare_nil_lookup</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st<sub>1</sub>:362" class="idref" href="#pe_st<sub>1</sub>:362"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:363" class="idref" href="#pe_st<sub>2</sub>:363"><span class="id" title="binder">pe_st<sub>2</sub></span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:362"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:363"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="V:364" class="idref" href="#V:364"><span class="id" title="binder">V</span></a>, <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:362"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#V:364"><span class="id" title="variable">V</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#pe_lookup"><span class="id" title="definition">pe_lookup</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:363"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="PE.html#V:364"><span class="id" title="variable">V</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">H</span> <span class="id" title="var">V</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> (<a class="idref" href="PE.html#pe_compare_correct"><span class="id" title="lemma">pe_compare_correct</span></a> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">V</span>).<br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">intro</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>0</sub></span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="Loop.pe_compare_nil_update" class="idref" href="#Loop.pe_compare_nil_update"><span class="id" title="lemma">pe_compare_nil_update</span></a>: <span class="id" title="keyword">∀</span> <a id="pe_st<sub>1</sub>:365" class="idref" href="#pe_st<sub>1</sub>:365"><span class="id" title="binder">pe_st<sub>1</sub></span></a> <a id="pe_st<sub>2</sub>:366" class="idref" href="#pe_st<sub>2</sub>:366"><span class="id" title="binder">pe_st<sub>2</sub></span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_compare"><span class="id" title="definition">pe_compare</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:365"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:366"><span class="id" title="variable">pe_st<sub>2</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ae9a5e1034e143b218b09d8e454472bd"><span class="id" title="notation">[]</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:367" class="idref" href="#st:367"><span class="id" title="binder">st</span></a>, <a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:367"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st<sub>1</sub>:365"><span class="id" title="variable">pe_st<sub>1</sub></span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:367"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st<sub>2</sub>:366"><span class="id" title="variable">pe_st<sub>2</sub></span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">pe_st<sub>1</sub></span> <span class="id" title="var">pe_st<sub>2</sub></span> <span class="id" title="var">H</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">V</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> !<a class="idref" href="PE.html#pe_update_correct"><span class="id" title="lemma">pe_update_correct</span></a>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.pe_compare_nil_lookup"><span class="id" title="lemma">pe_compare_nil_lookup</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">V</span>:=<span class="id" title="var">V</span>) <span class="id" title="keyword">in</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Reserved Notation</span> &quot;c' '/' pe_st' '/' c'' '/' st '==&gt;' st'' '#' n"<br/>
&nbsp;&nbsp;(<span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 40, <span class="id" title="var">pe_st'</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">c''</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39,<br/>
&nbsp;&nbsp;&nbsp;<span class="id" title="var">st</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39, <span class="id" title="var">st''</span> <span class="id" title="tactic">at</span> <span class="id" title="keyword">level</span> 39).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Inductive</span> <a id="Loop.pe_ceval_count" class="idref" href="#Loop.pe_ceval_count"><span class="id" title="inductive">pe_ceval_count</span></a> (<a id="c':368" class="idref" href="#c':368"><span class="id" title="binder">c'</span></a>:<span class="id" title="inductive">com</span>) (<a id="pe_st':369" class="idref" href="#pe_st':369"><span class="id" title="binder">pe_st'</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="c'':370" class="idref" href="#c'':370"><span class="id" title="binder">c''</span></a>:<span class="id" title="inductive">com</span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<a id="st:371" class="idref" href="#st:371"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) (<a id="st'':372" class="idref" href="#st'':372"><span class="id" title="binder">st''</span></a>:<span class="id" title="definition">state</span>) (<a id="n:373" class="idref" href="#n:373"><span class="id" title="binder">n</span></a>:<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>) : <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="Loop.pe_ceval_count_intro" class="idref" href="#Loop.pe_ceval_count_intro"><span class="id" title="constructor">pe_ceval_count_intro</span></a> : <span class="id" title="keyword">∀</span> <a id="st':376" class="idref" href="#st':376"><span class="id" title="binder">st'</span></a> <a id="n':377" class="idref" href="#n':377"><span class="id" title="binder">n'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#st:371"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c':368"><span class="id" title="variable">c'</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st':376"><span class="id" title="variable">st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c'':370"><span class="id" title="variable">c''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st':376"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#pe_st':369"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':372"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n':377"><span class="id" title="variable">n'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#n':377"><span class="id" title="variable">n'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Peano.html#cb53cf0ee22c036a03b4a9281c68b5a<sub>3</sub>"><span class="id" title="notation">≤</span></a> <a class="idref" href="PE.html#n:373"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#c':368"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':369"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':370"><span class="id" title="variable">c''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:371"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':372"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:373"><span class="id" title="variable">n</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">where</span> <a id="530219aa3c99e1366657faa7f9243326" class="idref" href="#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">&quot;</span></a>c' '/' pe_st' '/' c'' '/' st '==&gt;' st'' '#' n" :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<a class="idref" href="PE.html#pe_ceval_count:375"><span class="id" title="inductive">pe_ceval_count</span></a> <span class="id" title="var">c'</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c''</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span> <span class="id" title="var">n</span>).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Local Hint Constructors</span> <a class="idref" href="PE.html#pe_ceval_count"><span class="id" title="inductive">pe_ceval_count</span></a> : <span class="id" title="var">core</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Lemma</span> <a id="Loop.pe_ceval_count_le" class="idref" href="#Loop.pe_ceval_count_le"><span class="id" title="lemma">pe_ceval_count_le</span></a>: <span class="id" title="keyword">∀</span> <a id="c':378" class="idref" href="#c':378"><span class="id" title="binder">c'</span></a> <a id="pe_st':379" class="idref" href="#pe_st':379"><span class="id" title="binder">pe_st'</span></a> <a id="c'':380" class="idref" href="#c'':380"><span class="id" title="binder">c''</span></a> <a id="st:381" class="idref" href="#st:381"><span class="id" title="binder">st</span></a> <a id="st'':382" class="idref" href="#st'':382"><span class="id" title="binder">st''</span></a> <a id="n:383" class="idref" href="#n:383"><span class="id" title="binder">n</span></a> <a id="n':384" class="idref" href="#n':384"><span class="id" title="binder">n'</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#n':384"><span class="id" title="variable">n'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Peano.html#cb53cf0ee22c036a03b4a9281c68b5a<sub>3</sub>"><span class="id" title="notation">≤</span></a> <a class="idref" href="PE.html#n:383"><span class="id" title="variable">n</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#c':378"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':379"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':380"><span class="id" title="variable">c''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:381"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':382"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n':384"><span class="id" title="variable">n'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#c':378"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':379"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':380"><span class="id" title="variable">c''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:381"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':382"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:383"><span class="id" title="variable">n</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c'</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c''</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span> <span class="id" title="var">n</span> <span class="id" title="var">n'</span> <span class="id" title="var">Hle</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>; <span class="id" title="tactic">try</span> <span class="id" title="var">eassumption</span>. <span class="id" title="var">lia</span>. <span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="Loop.pe_com_complete" class="idref" href="#Loop.pe_com_complete"><span class="id" title="lemma">pe_com_complete</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="c:385" class="idref" href="#c:385"><span class="id" title="binder">c</span></a> <a id="pe_st:386" class="idref" href="#pe_st:386"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':387" class="idref" href="#pe_st':387"><span class="id" title="binder">pe_st'</span></a> <a id="c':388" class="idref" href="#c':388"><span class="id" title="binder">c'</span></a> <a id="c'':389" class="idref" href="#c'':389"><span class="id" title="binder">c''</span></a>, <a class="idref" href="PE.html#c:385"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:386"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c':388"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':387"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':389"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:390" class="idref" href="#st:390"><span class="id" title="binder">st</span></a> <a id="st'':391" class="idref" href="#st'':391"><span class="id" title="binder">st''</span></a> <a id="n:392" class="idref" href="#n:392"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c:385"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:390"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:386"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':391"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#393ab9c73cfe2dca7780259f226e53a<sub>7</sub>"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:392"><span class="id" title="variable">n</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c':388"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':387"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':389"><span class="id" title="variable">c''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:390"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':391"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:392"><span class="id" title="variable">n</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c'</span> <span class="id" title="var">c''</span> <span class="id" title="var">Hpe</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Hpe</span>; <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span> <span class="id" title="var">n</span> <span class="id" title="var">Heval</span>;<br/>
&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>, → <span class="id" title="var">H</span> <span class="id" title="keyword">in</span> *; <span class="id" title="var">solve_by_invert</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[]);<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnStatic&nbsp;*)</span> <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">econstructor</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_add"><span class="id" title="lemma">pe_update_update_add</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.E'Skip"><span class="id" title="constructor">E'Skip</span></a>. <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnDynamic&nbsp;*)</span> <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_remove"><span class="id" title="lemma">pe_update_update_remove</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.E'Skip"><span class="id" title="constructor">E'Skip</span></a>. <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_Seq&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span> <span class="id" title="keyword">as</span> [? ? ? <span class="id" title="var">Hskip</span> ?]. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Hskip</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>; <span class="id" title="tactic">eauto</span>. <span class="id" title="var">lia</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_If&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E'IfTrue&nbsp;*)</span> <span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>. <span class="id" title="var">eassumption</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="var">eassumption</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfFalse&nbsp;*)</span> <span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>. <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>. <span class="id" title="var">eassumption</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="var">eassumption</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span> <span class="id" title="keyword">as</span> [? ? ? <span class="id" title="var">Hskip</span> ?]. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Hskip</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>; <span class="id" title="tactic">eauto</span>. <span class="id" title="var">lia</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_While&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_WhileFalse&nbsp;*)</span> <span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>2</sub></span>; <span class="id" title="tactic">subst</span>; <span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">auto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_WhileTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span> <span class="id" title="keyword">as</span> [? ? ? <span class="id" title="var">Hskip</span> ?]. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Hskip</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">repeat</span> <span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>; <span class="id" title="tactic">eauto</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a>, &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">lia</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileFixedLoop&nbsp;*)</span> <span class="id" title="var">exfalso</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> (<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#S"><span class="id" title="constructor">S</span></a> (<span class="id" title="var">n<sub>1</sub></span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Nat.html#0dacc1786c5ba797d47dd85006231633"><span class="id" title="notation">+</span></a> <span class="id" title="var">n<sub>2</sub></span>)). <span class="id" title="tactic">intros</span> <span class="id" title="var">n</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">clear</span> - <span class="id" title="var">H</span> <span class="id" title="var">H<sub>0</sub></span> <span class="id" title="var">IHHpe1</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">n</span> <span class="id" title="keyword">using</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.Wf_nat.html#lt_wf_ind"><span class="id" title="lemma">lt_wf_ind</span></a>; <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">Heval</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E'WhileFalse&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>, <span class="id" title="var">H</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>7</sub></span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>7</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E'WhileTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span> <span class="id" title="keyword">as</span> [? ? ? <span class="id" title="var">Hskip</span> ?]. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Hskip</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- (<a class="idref" href="PE.html#Loop.pe_compare_nil_update"><span class="id" title="lemma">pe_compare_nil_update</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="var">H<sub>0</sub></span>) <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>7</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="var">H<sub>1</sub></span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>7</sub></span>; [| <span class="id" title="var">lia</span>]. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>7</sub></span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileFixed&nbsp;*)</span> <span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">n</span> <span class="id" title="keyword">using</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Arith.Wf_nat.html#lt_wf_ind"><span class="id" title="lemma">lt_wf_ind</span></a>; <span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">Heval</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E'WhileFalse&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>8</sub></span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E'WhileTrue&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>5</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe1</span> <span class="id" title="keyword">as</span> [? ? ? <span class="id" title="var">Hskip</span> ?]. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Hskip</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- (<a class="idref" href="PE.html#Loop.pe_compare_nil_update"><span class="id" title="lemma">pe_compare_nil_update</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="var">H<sub>1</sub></span>) <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>8</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="var">H<sub>2</sub></span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>8</sub></span>; [| <span class="id" title="var">lia</span>]. <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>8</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>; [ <span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_WhileTrue</span>; <span class="id" title="tactic">eauto</span> | <span class="id" title="var">eassumption</span> | <span class="id" title="var">lia</span>].<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="Loop.pe_com_sound" class="idref" href="#Loop.pe_com_sound"><span class="id" title="lemma">pe_com_sound</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="c:393" class="idref" href="#c:393"><span class="id" title="binder">c</span></a> <a id="pe_st:394" class="idref" href="#pe_st:394"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':395" class="idref" href="#pe_st':395"><span class="id" title="binder">pe_st'</span></a> <a id="c':396" class="idref" href="#c':396"><span class="id" title="binder">c'</span></a> <a id="c'':397" class="idref" href="#c'':397"><span class="id" title="binder">c''</span></a>, <a class="idref" href="PE.html#c:393"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:394"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c':396"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':395"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':397"><span class="id" title="variable">c''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:398" class="idref" href="#st:398"><span class="id" title="binder">st</span></a> <a id="st'':399" class="idref" href="#st'':399"><span class="id" title="binder">st''</span></a> <a id="n:400" class="idref" href="#n:400"><span class="id" title="binder">n</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#c':396"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':395"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#c'':397"><span class="id" title="variable">c''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#st:398"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#st'':399"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#530219aa3c99e1366657faa7f9243326"><span class="id" title="notation">#</span></a> <a class="idref" href="PE.html#n:400"><span class="id" title="variable">n</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:398"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:394"><span class="id" title="variable">pe_st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:393"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st'':399"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c'</span> <span class="id" title="var">c''</span> <span class="id" title="var">Hpe</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Hpe</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span> <span class="id" title="var">n</span> [<span class="id" title="var">st'</span> <span class="id" title="var">n'</span> <span class="id" title="var">Heval</span> <span class="id" title="var">Heval'</span> <span class="id" title="var">Hle</span>];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; []; <span class="id" title="tactic">subst</span>);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> (<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval'</span>; []; <span class="id" title="tactic">subst</span>); <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnStatic&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_add"><span class="id" title="lemma">pe_update_update_add</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_Asgn</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_AsgnDynamic&nbsp;*)</span> <span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_update_update_remove"><span class="id" title="lemma">pe_update_update_remove</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_Asgn</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_Seq&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_Seq</span>; <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_IfTrue&nbsp;*)</span> <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_IfFalse&nbsp;*)</span> <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_If&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>; <span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>7</sub></span>; <span class="id" title="tactic">subst</span>; <span class="id" title="tactic">clear</span> <span class="id" title="var">H<sub>7</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="lemma">ceval_deterministic</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>8</sub></span>; [| <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>]. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfTrue</span>. <span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe1</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfFalse&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="lemma">ceval_deterministic</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>8</sub></span>; [| <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>]. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_IfFalse</span>. <span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileFalse&nbsp;*)</span> <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_WhileFalse</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileTrue&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_WhileTrue</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">rewrite</span> → <span class="id" title="var">H</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe1</span>. <span class="id" title="tactic">eauto</span>. <span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_While&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>9</sub></span>. <span class="id" title="tactic">subst</span>. <span class="id" title="tactic">clear</span> <span class="id" title="var">H<sub>9</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>10</sub></span>. <span class="id" title="tactic">subst</span>. <span class="id" title="tactic">clear</span> <span class="id" title="var">H<sub>10</sub></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="lemma">ceval_deterministic</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>11</sub></span>; [| <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>]. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_compare_update"><span class="id" title="lemma">pe_compare_update</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_WhileTrue</span>. <span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe1</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_IfFalse&nbsp;*)</span> <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.ceval_count_sound"><span class="id" title="lemma">ceval_count_sound</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="lemma">ceval_deterministic</span> <span class="id" title="keyword">in</span> <span class="id" title="var">H<sub>9</sub></span>; [| <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#eval_assign"><span class="id" title="lemma">eval_assign</span></a>]. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- <a class="idref" href="PE.html#assign_removes"><span class="id" title="lemma">assign_removes</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H<sub>2</sub></span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;c<sub>2</sub>''&nbsp;=&nbsp;skip&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval'</span>. <span class="id" title="tactic">subst</span>. <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_WhileFalse</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> → <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;× <span class="comment">(*&nbsp;c<sub>2</sub>''&nbsp;=&nbsp;while&nbsp;b<sub>1</sub>&nbsp;do&nbsp;c<sub>1</sub>&nbsp;end&nbsp;*)</span> <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileFixedEnd&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.ceval_count_sound"><span class="id" title="lemma">ceval_count_sound</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="var">Heval'</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileFixedLoop&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <span class="id" title="axiom">loop_never_stops</span> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;PE_WhileFixed&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">clear</span> - <span class="id" title="var">H<sub>1</sub></span> <span class="id" title="var">IHHpe1</span> <span class="id" title="var">IHHpe2</span> <span class="id" title="var">Heval</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">while</span> <a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b<sub>1</sub></span> <span class="id" title="notation">do</span> <span class="id" title="var">c<sub>1</sub>'</span><span class="id" title="notation">;</span> <span class="id" title="var">c<sub>2</sub>'</span> <span class="id" title="notation">end</span><span class="id" title="notation">}&gt;</span> <span class="id" title="keyword">as</span> <span class="id" title="var">c'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Heval</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heqc'</span>; <span class="id" title="tactic">subst</span>; <span class="id" title="tactic">clear</span> <span class="id" title="var">Heqc'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_WhileFalse&nbsp;*)</span> <span class="id" title="tactic">apply</span> <span class="id" title="constructor">E_WhileFalse</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_WhileTrue&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">assert</span> (<span class="id" title="var">IHHeval2'</span> := <span class="id" title="var">IHHeval2</span> (<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#refl_equal"><span class="id" title="abbreviation">refl_equal</span></a> <span class="id" title="var">_</span>)).<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.ceval_count_complete"><span class="id" title="lemma">ceval_count_complete</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">IHHeval2'</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">IHHeval2'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">clear</span> <span class="id" title="var">IHHeval1</span> <span class="id" title="var">IHHeval2</span> <span class="id" title="var">IHHeval2'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval1</span>. <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="constructor">E_WhileTrue</span>. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>. <span class="id" title="tactic">assumption</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <span class="id" title="var">IHHpe2</span>. <span class="id" title="tactic">econstructor</span>. <span class="id" title="var">eassumption</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">rewrite</span> &lt;- (<a class="idref" href="PE.html#Loop.pe_compare_nil_update"><span class="id" title="lemma">pe_compare_nil_update</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="var">H<sub>1</sub></span>). <span class="id" title="var">eassumption</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Peano.html#le_n"><span class="id" title="constructor">le_n</span></a>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Corollary</span> <a id="Loop.pe_com_correct" class="idref" href="#Loop.pe_com_correct"><span class="id" title="lemma">pe_com_correct</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="c:401" class="idref" href="#c:401"><span class="id" title="binder">c</span></a> <a id="pe_st:402" class="idref" href="#pe_st:402"><span class="id" title="binder">pe_st</span></a> <a id="pe_st':403" class="idref" href="#pe_st':403"><span class="id" title="binder">pe_st'</span></a> <a id="c':404" class="idref" href="#c':404"><span class="id" title="binder">c'</span></a>, <a class="idref" href="PE.html#c:401"><span class="id" title="variable">c</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st:402"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">==&gt;</span></a> <a class="idref" href="PE.html#c':404"><span class="id" title="variable">c'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <a class="idref" href="PE.html#pe_st':403"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="PE.html#7120073eb86390e07bb1d827e01dd845"><span class="id" title="notation">/</span></a> <span class="id" title="notation">&lt;{</span><span class="id" title="notation">skip</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> <a id="st:405" class="idref" href="#st:405"><span class="id" title="binder">st</span></a> <a id="st'':406" class="idref" href="#st'':406"><span class="id" title="binder">st''</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:405"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:402"><span class="id" title="variable">pe_st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c:401"><span class="id" title="variable">c</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st'':406"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">↔</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">(</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#a883bdd010993579f99d60b3775bcf54"><span class="id" title="notation">∃</span></a> <a id="st':407" class="idref" href="#st':407"><span class="id" title="binder">st'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#a883bdd010993579f99d60b3775bcf54"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#st:405"><span class="id" title="variable">st</span></a> <span class="id" title="notation">=[</span> <a class="idref" href="PE.html#c':404"><span class="id" title="variable">c'</span></a> <span class="id" title="notation">]=&gt;</span> <a class="idref" href="PE.html#st':407"><span class="id" title="variable">st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#ba2b0e492d2b4675a0acf3ea92aabadd"><span class="id" title="notation">∧</span></a> <a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st':407"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#pe_st':403"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#st'':406"><span class="id" title="variable">st''</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span> <span class="id" title="var">c</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">c'</span> <span class="id" title="var">H</span> <span class="id" title="var">st</span> <span class="id" title="var">st''</span>. <span class="id" title="tactic">split</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;*)</span> <span class="id" title="tactic">intros</span> <span class="id" title="var">Heval</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.ceval_count_complete"><span class="id" title="lemma">ceval_count_complete</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Heval</span>. <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heval</span> <span class="id" title="keyword">as</span> [<span class="id" title="var">n</span> <span class="id" title="var">Heval'</span>].<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.pe_com_complete"><span class="id" title="lemma">pe_com_complete</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">st</span>:=<span class="id" title="var">st</span>) (<span class="id" title="var">st''</span>:=<span class="id" title="var">st''</span>) (<span class="id" title="var">n</span>:=<span class="id" title="var">n</span>) <span class="id" title="keyword">in</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span> <span class="id" title="keyword">as</span> [? ? ? <span class="id" title="var">Hskip</span> ?]. <span class="id" title="tactic">inversion</span> <span class="id" title="var">Hskip</span>. <span class="id" title="tactic">subst</span>. <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">assumption</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;&lt;-&nbsp;*)</span> <span class="id" title="tactic">intros</span> [<span class="id" title="var">st'</span> [<span class="id" title="var">Heval</span> <span class="id" title="var">Heq</span>] ]. <span class="id" title="tactic">subst</span> <span class="id" title="var">st''</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#Loop.pe_com_sound"><span class="id" title="lemma">pe_com_sound</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">econstructor</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">Heval</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#Loop.E'Skip"><span class="id" title="constructor">E'Skip</span></a>. <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Peano.html#le_n"><span class="id" title="constructor">le_n</span></a>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">End</span> <a class="idref" href="PE.html#Loop"><span class="id" title="module">Loop</span></a>.<br/>
</div>

<div class="doc">
<a id="lab488"></a><h1 class="section">Partial Evaluation of Flowchart Programs</h1>

<div class="paragraph"> </div>

 Instead of partially evaluating <span class="inlinecode"><span class="id" title="var">while</span></span> loops directly, the
    standard approach to partially evaluating imperative programs is
    to convert them into <i>flowcharts</i>.  In other words, it turns out
    that adding labels and jumps to our language makes it much easier
    to partially evaluate.  The result of partially evaluating a
    flowchart is a residual flowchart.  If we are lucky, the jumps in
    the residual flowchart can be converted back to <span class="inlinecode"><span class="id" title="var">while</span></span> loops, but
    that is not possible in general; we do not pursue it here. 
<div class="paragraph"> </div>

<a id="lab489"></a><h2 class="section">Basic blocks</h2>

<div class="paragraph"> </div>

 A flowchart is made of <i>basic blocks</i>, which we represent with the
    inductive type <span class="inlinecode"><span class="id" title="var">block</span></span>.  A basic block is a sequence of
    assignments (the constructor <span class="inlinecode"><span class="id" title="var">Assign</span></span>), concluding with a
    conditional jump (the constructor <span class="inlinecode"><span class="id" title="var">If</span></span>) or an unconditional jump
    (the constructor <span class="inlinecode"><span class="id" title="var">Goto</span></span>).  The destinations of the jumps are
    specified by <i>labels</i>, which can be of any type.  Therefore, we
    parameterize the <span class="inlinecode"><span class="id" title="var">block</span></span> type by the type of labels. 
</div>
<div class="code">

<span class="id" title="keyword">Inductive</span> <a id="block" class="idref" href="#block"><span class="id" title="inductive">block</span></a> (<a id="Label:408" class="idref" href="#Label:408"><span class="id" title="binder">Label</span></a>:<span class="id" title="keyword">Type</span>) : <span class="id" title="keyword">Type</span> :=<br/>
&nbsp;&nbsp;| <a id="Goto" class="idref" href="#Goto"><span class="id" title="constructor">Goto</span></a> : <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#block:409"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a><br/>
&nbsp;&nbsp;| <a id="If" class="idref" href="#If"><span class="id" title="constructor">If</span></a> : <span class="id" title="inductive">bexp</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#block:409"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a><br/>
&nbsp;&nbsp;| <a id="Assign" class="idref" href="#Assign"><span class="id" title="constructor">Assign</span></a> : <a class="idref" href="http://coq.inria.fr/library//Coq.Strings.String.html#string"><span class="id" title="inductive">string</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="inductive">aexp</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#block:409"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="PE.html#block:409"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#Label:408"><span class="id" title="variable">Label</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="var">Arguments</span> <a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> {<span class="id" title="var">Label</span>} <span class="id" title="var">_</span>.<br/>
<span class="id" title="var">Arguments</span> <a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a>   {<span class="id" title="var">Label</span>} <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="var">_</span>.<br/>
<span class="id" title="var">Arguments</span> <a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> {<span class="id" title="var">Label</span>} <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="var">_</span>.<br/>
</div>

<div class="doc">
We use the "even or odd" program, expressed above in Imp, as our
    running example.  Converting this program into a flowchart turns
    out to require 4 labels, so we define the following type. 
</div>
<div class="code">

<span class="id" title="keyword">Inductive</span> <a id="parity_label" class="idref" href="#parity_label"><span class="id" title="inductive">parity_label</span></a> : <span class="id" title="keyword">Type</span> :=<br/>
&nbsp;&nbsp;| <a id="entry" class="idref" href="#entry"><span class="id" title="constructor">entry</span></a> : <a class="idref" href="PE.html#parity_label:411"><span class="id" title="inductive">parity_label</span></a><br/>
&nbsp;&nbsp;| <a id="loop" class="idref" href="#loop"><span class="id" title="constructor">loop</span></a>  : <a class="idref" href="PE.html#parity_label:411"><span class="id" title="inductive">parity_label</span></a><br/>
&nbsp;&nbsp;| <a id="body" class="idref" href="#body"><span class="id" title="constructor">body</span></a>  : <a class="idref" href="PE.html#parity_label:411"><span class="id" title="inductive">parity_label</span></a><br/>
&nbsp;&nbsp;| <a id="done" class="idref" href="#done"><span class="id" title="constructor">done</span></a>  : <a class="idref" href="PE.html#parity_label:411"><span class="id" title="inductive">parity_label</span></a>.<br/>
</div>

<div class="doc">
The following <span class="inlinecode"><span class="id" title="var">block</span></span> is the basic block found at the <span class="inlinecode"><span class="id" title="var">body</span></span> label
    of the example program. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="parity_body" class="idref" href="#parity_body"><span class="id" title="definition">parity_body</span></a> : <a class="idref" href="PE.html#block"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#parity_label"><span class="id" title="inductive">parity_label</span></a> :=<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="definition">Y</span> <span class="id" title="notation">&lt;{</span><span class="id" title="definition">Y</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;(<a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="definition">X</span> <span class="id" title="notation">&lt;{</span>1 <span class="id" title="notation">-</span> <span class="id" title="definition">X</span><span class="id" title="notation">}&gt;</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <a class="idref" href="PE.html#loop"><span class="id" title="constructor">loop</span></a>)).<br/>
</div>

<div class="doc">
To evaluate a basic block, given an initial state, is to compute
    the final state and the label to jump to next.  Because basic
    blocks do not <i>contain</i> loops or other control structures,
    evaluation of basic blocks is a total function -- we don't need to
    worry about non-termination. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="keval" class="idref" href="#keval"><span class="id" title="definition">keval</span></a> {<a id="L:413" class="idref" href="#L:413"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>} (<a id="st:414" class="idref" href="#st:414"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) (<a id="k:415" class="idref" href="#k:415"><span class="id" title="binder">k</span></a> : <a class="idref" href="PE.html#block"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#L:413"><span class="id" title="variable">L</span></a>) : <span class="id" title="definition">state</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#11c698c8685bb8ab1cf725545c085ac<sub>4</sub>"><span class="id" title="notation">×</span></a> <a class="idref" href="PE.html#L:413"><span class="id" title="variable">L</span></a> :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#k:415"><span class="id" title="variable">k</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <span class="id" title="var">l</span> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#st:414"><span class="id" title="variable">st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a> <span class="id" title="var">b</span> <span class="id" title="var">l<sub>1</sub></span> <span class="id" title="var">l<sub>2</sub></span> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#st:414"><span class="id" title="variable">st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="keyword">if</span> <span class="id" title="definition">beval</span> <a class="idref" href="PE.html#st:414"><span class="id" title="variable">st</span></a> <span class="id" title="var">b</span> <span class="id" title="keyword">then</span> <span class="id" title="var">l<sub>1</sub></span> <span class="id" title="keyword">else</span> <span class="id" title="var">l<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="var">i</span> <span class="id" title="var">a</span> <span class="id" title="var">k</span> ⇒ <a class="idref" href="PE.html#keval:416"><span class="id" title="definition">keval</span></a> (<span class="id" title="definition">t_update</span> <a class="idref" href="PE.html#st:414"><span class="id" title="variable">st</span></a> <span class="id" title="var">i</span> (<span class="id" title="definition">aeval</span> <a class="idref" href="PE.html#st:414"><span class="id" title="variable">st</span></a> <span class="id" title="var">a</span>)) <a class="idref" href="PE.html#k:415"><span class="id" title="variable">k</span></a><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="keval_example" class="idref" href="#keval_example"><span class="id" title="definition">keval_example</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> <span class="id" title="definition">empty_st</span> <a class="idref" href="PE.html#parity_body"><span class="id" title="definition">parity_body</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">((</span></a><span class="id" title="definition">X</span> <span class="id" title="notation">!<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span></span> 1 <span class="id" title="notation">;</span> <span class="id" title="definition">Y</span> <span class="id" title="notation">!<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span></span> 0<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">),</span></a> <a class="idref" href="PE.html#loop"><span class="id" title="constructor">loop</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a>.<br/>
<div class="togglescript" id="proofcontrol5" onclick="toggleDisplay('proof5');toggleDisplay('proofcontrol5')"><span class="show"></span></div>
<div class="proofscript" id="proof5" onclick="toggleDisplay('proof5');toggleDisplay('proofcontrol5')">
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>
</div>

<div class="doc">
<a id="lab490"></a><h2 class="section">Flowchart programs</h2>

<div class="paragraph"> </div>

 A flowchart program is simply a lookup function that maps labels
    to basic blocks.  Actually, some labels are <i>halting states</i> and
    do not map to any basic block.  So, more precisely, a flowchart
    <span class="inlinecode"><span class="id" title="var">program</span></span> whose labels are of type <span class="inlinecode"><span class="id" title="var">L</span></span> is a function from <span class="inlinecode"><span class="id" title="var">L</span></span> to
    <span class="inlinecode"><span class="id" title="var">option</span></span> <span class="inlinecode">(<span class="id" title="var">block</span></span> <span class="inlinecode"><span class="id" title="var">L</span>)</span>. 
</div>
<div class="code">

<span class="id" title="keyword">Definition</span> <a id="program" class="idref" href="#program"><span class="id" title="definition">program</span></a> (<a id="L:418" class="idref" href="#L:418"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>) : <span class="id" title="keyword">Type</span> := <a class="idref" href="PE.html#L:418"><span class="id" title="variable">L</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#option"><span class="id" title="inductive">option</span></a> (<a class="idref" href="PE.html#block"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#L:418"><span class="id" title="variable">L</span></a>).<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Definition</span> <a id="parity" class="idref" href="#parity"><span class="id" title="definition">parity</span></a> : <a class="idref" href="PE.html#program"><span class="id" title="definition">program</span></a> <a class="idref" href="PE.html#parity_label"><span class="id" title="inductive">parity_label</span></a> := <span class="id" title="keyword">fun</span> <a id="l:419" class="idref" href="#l:419"><span class="id" title="binder">l</span></a> ⇒<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#l:419"><span class="id" title="variable">l</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#entry"><span class="id" title="constructor">entry</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> (<a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="definition">X</span> 0 (<a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <a class="idref" href="PE.html#loop"><span class="id" title="constructor">loop</span></a>))<br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#loop"><span class="id" title="constructor">loop</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> (<a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a> <span class="id" title="notation">&lt;{</span>1 <span class="id" title="notation">≤</span> <span class="id" title="definition">Y</span><span class="id" title="notation">}&gt;</span> <a class="idref" href="PE.html#body"><span class="id" title="constructor">body</span></a> <a class="idref" href="PE.html#done"><span class="id" title="constructor">done</span></a>)<br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#body"><span class="id" title="constructor">body</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <a class="idref" href="PE.html#parity_body"><span class="id" title="definition">parity_body</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#done"><span class="id" title="constructor">done</span></a> ⇒ <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> <span class="comment">(*&nbsp;halt&nbsp;*)</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/>
</div>

<div class="doc">
Unlike a basic block, a program may not terminate, so we model the
    evaluation of programs by an inductive relation <span class="inlinecode"><span class="id" title="var">peval</span></span> rather
    than a recursive function. 
</div>
<div class="code">

<span class="id" title="keyword">Inductive</span> <a id="peval" class="idref" href="#peval"><span class="id" title="inductive">peval</span></a> {<a id="L:421" class="idref" href="#L:421"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>} (<a id="p:422" class="idref" href="#p:422"><span class="id" title="binder">p</span></a> : <a class="idref" href="PE.html#program"><span class="id" title="definition">program</span></a> <a class="idref" href="PE.html#L:421"><span class="id" title="variable">L</span></a>)<br/>
&nbsp;&nbsp;: <span class="id" title="definition">state</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="var">L</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="definition">state</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="var">L</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a> <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="E_None" class="idref" href="#E_None"><span class="id" title="constructor">E_None</span></a>: <span class="id" title="keyword">∀</span> <a id="st:425" class="idref" href="#st:425"><span class="id" title="binder">st</span></a> <a id="l:426" class="idref" href="#l:426"><span class="id" title="binder">l</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#p:422"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#l:426"><span class="id" title="variable">l</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#None"><span class="id" title="constructor">None</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#peval:423"><span class="id" title="inductive">peval</span></a> <a class="idref" href="PE.html#p:422"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#st:425"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#l:426"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#st:425"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#l:426"><span class="id" title="variable">l</span></a><br/>
&nbsp;&nbsp;| <a id="E_Some" class="idref" href="#E_Some"><span class="id" title="constructor">E_Some</span></a>: <span class="id" title="keyword">∀</span> <a id="st:427" class="idref" href="#st:427"><span class="id" title="binder">st</span></a> <a id="l:428" class="idref" href="#l:428"><span class="id" title="binder">l</span></a> <a id="k:429" class="idref" href="#k:429"><span class="id" title="binder">k</span></a> <a id="st':430" class="idref" href="#st':430"><span class="id" title="binder">st'</span></a> <a id="l':431" class="idref" href="#l':431"><span class="id" title="binder">l'</span></a> <a id="st'':432" class="idref" href="#st'':432"><span class="id" title="binder">st''</span></a> <a id="l'':433" class="idref" href="#l'':433"><span class="id" title="binder">l''</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#p:422"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#l:428"><span class="id" title="variable">l</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#Some"><span class="id" title="constructor">Some</span></a> <a class="idref" href="PE.html#k:429"><span class="id" title="variable">k</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> <a class="idref" href="PE.html#st:427"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#k:429"><span class="id" title="variable">k</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#st':430"><span class="id" title="variable">st'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#l':431"><span class="id" title="variable">l'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#peval:423"><span class="id" title="inductive">peval</span></a> <a class="idref" href="PE.html#p:422"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#st':430"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#l':431"><span class="id" title="variable">l'</span></a> <a class="idref" href="PE.html#st'':432"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#l'':433"><span class="id" title="variable">l''</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#peval:423"><span class="id" title="inductive">peval</span></a> <a class="idref" href="PE.html#p:422"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#st:427"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#l:428"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#st'':432"><span class="id" title="variable">st''</span></a> <a class="idref" href="PE.html#l'':433"><span class="id" title="variable">l''</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="parity_eval" class="idref" href="#parity_eval"><span class="id" title="definition">parity_eval</span></a>: <a class="idref" href="PE.html#peval"><span class="id" title="inductive">peval</span></a> <a class="idref" href="PE.html#parity"><span class="id" title="definition">parity</span></a> <span class="id" title="definition">empty_st</span> <a class="idref" href="PE.html#entry"><span class="id" title="constructor">entry</span></a>  <span class="id" title="definition">empty_st</span> <a class="idref" href="PE.html#done"><span class="id" title="constructor">done</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#f_equal"><span class="id" title="lemma">f_equal</span></a> <span class="id" title="keyword">with</span> (<span class="id" title="var">f</span> := <span class="id" title="keyword">fun</span> <a id="st:437" class="idref" href="#st:437"><span class="id" title="binder">st</span></a> ⇒ <a class="idref" href="PE.html#peval"><span class="id" title="inductive">peval</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <span class="id" title="var">_</span> <a class="idref" href="PE.html#st:434"><span class="id" title="variable">st</span></a> <span class="id" title="var">_</span>).<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#E_Some"><span class="id" title="constructor">E_Some</span></a>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#E_Some"><span class="id" title="constructor">E_Some</span></a>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#E_None"><span class="id" title="constructor">E_None</span></a>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Logic.FunctionalExtensionality.html#functional_extensionality"><span class="id" title="lemma">functional_extensionality</span></a>. <span class="id" title="tactic">intros</span> <span class="id" title="var">i</span>. <span class="id" title="tactic">rewrite</span> <span class="id" title="axiom">t_update_same</span>; <span class="id" title="tactic">auto</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
</div>

<div class="doc">
<a id="lab491"></a><h2 class="section">Partial Evaluation of Basic Blocks and Flowchart Programs</h2>

<div class="paragraph"> </div>

 Partial evaluation changes the label type in a systematic way: if
    the label type used to be <span class="inlinecode"><span class="id" title="var">L</span></span>, it becomes <span class="inlinecode"><span class="id" title="var">pe_state</span></span> <span class="inlinecode">×</span> <span class="inlinecode"><span class="id" title="var">L</span></span>.  So the
    same label in the original program may be unfolded, or blown up,
    into multiple labels by being paired with different partial
    states.  For example, the label <span class="inlinecode"><span class="id" title="var">loop</span></span> in the <span class="inlinecode"><span class="id" title="var">parity</span></span> program
    will become two labels: <span class="inlinecode">([(<span class="id" title="var">X</span>,0)],</span> <span class="inlinecode"><span class="id" title="var">loop</span>)</span> and <span class="inlinecode">([(<span class="id" title="var">X</span>,1)],</span> <span class="inlinecode"><span class="id" title="var">loop</span>)</span>.
    This change of label type is reflected in the types of <span class="inlinecode"><span class="id" title="var">pe_block</span></span>
    and <span class="inlinecode"><span class="id" title="var">pe_program</span></span> defined presently. 
</div>
<div class="code">

<span class="id" title="keyword">Fixpoint</span> <a id="pe_block" class="idref" href="#pe_block"><span class="id" title="definition">pe_block</span></a> {<a id="L:438" class="idref" href="#L:438"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>} (<a id="pe_st:439" class="idref" href="#pe_st:439"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="k:440" class="idref" href="#k:440"><span class="id" title="binder">k</span></a> : <a class="idref" href="PE.html#block"><span class="id" title="inductive">block</span></a> <a class="idref" href="PE.html#L:438"><span class="id" title="variable">L</span></a>)<br/>
&nbsp;&nbsp;: <a class="idref" href="PE.html#block"><span class="id" title="inductive">block</span></a> (<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#11c698c8685bb8ab1cf725545c085ac<sub>4</sub>"><span class="id" title="notation">×</span></a> <a class="idref" href="PE.html#L:438"><span class="id" title="variable">L</span></a>) :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#k:440"><span class="id" title="variable">k</span></a> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <span class="id" title="var">l</span> ⇒ <a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a> <span class="id" title="var">b</span> <span class="id" title="var">l<sub>1</sub></span> <span class="id" title="var">l<sub>2</sub></span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">b</span> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="constructor">BTrue</span>  ⇒ <a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="constructor">BFalse</span> ⇒ <a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="var">b'</span>     ⇒ <a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a> <span class="id" title="var">b'</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;| <a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="var">i</span> <span class="id" title="var">a</span> <span class="id" title="var">k</span> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">a</span> <span class="id" title="keyword">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="constructor">ANum</span> <span class="id" title="var">n</span> ⇒ <a class="idref" href="PE.html#pe_block:441"><span class="id" title="definition">pe_block</span></a> (<a class="idref" href="PE.html#pe_add"><span class="id" title="definition">pe_add</span></a> <a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">i</span> <span class="id" title="var">n</span>) <a class="idref" href="PE.html#k:440"><span class="id" title="variable">k</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="var">a'</span> ⇒ <a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="var">i</span> <span class="id" title="var">a'</span> (<a class="idref" href="PE.html#pe_block:441"><span class="id" title="definition">pe_block</span></a> (<a class="idref" href="PE.html#pe_remove"><span class="id" title="definition">pe_remove</span></a> <a class="idref" href="PE.html#pe_st:439"><span class="id" title="variable">pe_st</span></a> <span class="id" title="var">i</span>) <a class="idref" href="PE.html#k:440"><span class="id" title="variable">k</span></a>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span><br/>
&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Example</span> <a id="pe_block_example" class="idref" href="#pe_block_example"><span class="id" title="definition">pe_block_example</span></a>:<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_block"><span class="id" title="definition">pe_block</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>0<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a> <a class="idref" href="PE.html#parity_body"><span class="id" title="definition">parity_body</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#Assign"><span class="id" title="constructor">Assign</span></a> <span class="id" title="definition">Y</span> <span class="id" title="notation">&lt;{</span><span class="id" title="definition">Y</span> <span class="id" title="notation">-</span> 1<span class="id" title="notation">}&gt;</span> (<a class="idref" href="PE.html#Goto"><span class="id" title="constructor">Goto</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">[</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="definition">X</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a>1<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Lists.List.html#ddd65c2f7ee73ecec433744948d846bb"><span class="id" title="notation">]</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#loop"><span class="id" title="constructor">loop</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a>).<br/>
<div class="togglescript" id="proofcontrol6" onclick="toggleDisplay('proof6');toggleDisplay('proofcontrol6')"><span class="show"></span></div>
<div class="proofscript" id="proof6" onclick="toggleDisplay('proof6');toggleDisplay('proofcontrol6')">
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="keyword">Qed</span>.<br/>
</div>

<br/>
<span class="id" title="keyword">Theorem</span> <a id="pe_block_correct" class="idref" href="#pe_block_correct"><span class="id" title="lemma">pe_block_correct</span></a>: <span class="id" title="keyword">∀</span> (<a id="L:443" class="idref" href="#L:443"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>) <a id="st:444" class="idref" href="#st:444"><span class="id" title="binder">st</span></a> <a id="pe_st:445" class="idref" href="#pe_st:445"><span class="id" title="binder">pe_st</span></a> <a id="k:446" class="idref" href="#k:446"><span class="id" title="binder">k</span></a> <a id="st':447" class="idref" href="#st':447"><span class="id" title="binder">st'</span></a> <a id="pe_st':448" class="idref" href="#pe_st':448"><span class="id" title="binder">pe_st'</span></a> (<a id="l':449" class="idref" href="#l':449"><span class="id" title="binder">l'</span></a>:<a class="idref" href="PE.html#L:443"><span class="id" title="variable">L</span></a>),<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> <a class="idref" href="PE.html#st:444"><span class="id" title="variable">st</span></a> (<a class="idref" href="PE.html#pe_block"><span class="id" title="definition">pe_block</span></a> <a class="idref" href="PE.html#pe_st:445"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#k:446"><span class="id" title="variable">k</span></a>) <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#st':447"><span class="id" title="variable">st'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st':448"><span class="id" title="variable">pe_st'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#l':449"><span class="id" title="variable">l'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">))</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:444"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:445"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#k:446"><span class="id" title="variable">k</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st':447"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#pe_st':448"><span class="id" title="variable">pe_st'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#l':449"><span class="id" title="variable">l'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span>. <span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">pe_st</span>. <span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">k</span> <span class="id" title="keyword">as</span> [<span class="id" title="var">l</span> | <span class="id" title="var">b</span> <span class="id" title="var">l<sub>1</sub></span> <span class="id" title="var">l<sub>2</sub></span> | <span class="id" title="var">i</span> <span class="id" title="var">a</span> <span class="id" title="var">k</span>];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">H</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;Goto&nbsp;*)</span> <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>; <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;If&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">replace</span> (<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> <span class="id" title="var">st</span> (<a class="idref" href="PE.html#pe_block"><span class="id" title="definition">pe_block</span></a> <span class="id" title="var">pe_st</span> (<a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a> <span class="id" title="var">b</span> <span class="id" title="var">l<sub>1</sub></span> <span class="id" title="var">l<sub>2</sub></span>)))<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">with</span> (<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> <span class="id" title="var">st</span> (<a class="idref" href="PE.html#If"><span class="id" title="constructor">If</span></a> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b</span>) <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">pe_st</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l<sub>1</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">pe_st</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l<sub>2</sub></span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a>))<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">in</span> <span class="id" title="var">H</span> <span class="id" title="tactic">by</span> (<span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b</span>); <span class="id" title="tactic">reflexivity</span>).<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> ×. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_bexp_correct"><span class="id" title="lemma">pe_bexp_correct</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<span class="id" title="definition">beval</span> <span class="id" title="var">st</span> (<a class="idref" href="PE.html#pe_bexp"><span class="id" title="definition">pe_bexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">b</span>)); <span class="id" title="tactic">inversion</span> <span class="id" title="var">H</span>; <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;Assign&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> ×. <span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_aexp_correct"><span class="id" title="lemma">pe_aexp_correct</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<a class="idref" href="PE.html#pe_aexp"><span class="id" title="definition">pe_aexp</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">a</span>); <span class="id" title="tactic">simpl</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">try</span> <span class="id" title="tactic">solve</span> [<span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_update_update_add"><span class="id" title="lemma">pe_update_update_add</span></a>; <span class="id" title="tactic">apply</span> <span class="id" title="var">IHk</span>; <span class="id" title="tactic">apply</span> <span class="id" title="var">H</span>];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">solve</span> [<span class="id" title="tactic">rewrite</span> <a class="idref" href="PE.html#pe_update_update_remove"><span class="id" title="lemma">pe_update_update_remove</span></a>; <span class="id" title="tactic">apply</span> <span class="id" title="var">IHk</span>; <span class="id" title="tactic">apply</span> <span class="id" title="var">H</span>].<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Definition</span> <a id="pe_program" class="idref" href="#pe_program"><span class="id" title="definition">pe_program</span></a> {<a id="L:450" class="idref" href="#L:450"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>} (<a id="p:451" class="idref" href="#p:451"><span class="id" title="binder">p</span></a> : <a class="idref" href="PE.html#program"><span class="id" title="definition">program</span></a> <a class="idref" href="PE.html#L:450"><span class="id" title="variable">L</span></a>)<br/>
&nbsp;&nbsp;: <a class="idref" href="PE.html#program"><span class="id" title="definition">program</span></a> (<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#11c698c8685bb8ab1cf725545c085ac<sub>4</sub>"><span class="id" title="notation">×</span></a> <a class="idref" href="PE.html#L:450"><span class="id" title="variable">L</span></a>) :=<br/>
&nbsp;&nbsp;<span class="id" title="keyword">fun</span> <a id="pe_l:452" class="idref" href="#pe_l:452"><span class="id" title="binder">pe_l</span></a> ⇒ <span class="id" title="keyword">match</span> <a class="idref" href="PE.html#pe_l:452"><span class="id" title="variable">pe_l</span></a> <span class="id" title="keyword">with</span> | <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">pe_st</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> ⇒<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#option_map"><span class="id" title="definition">option_map</span></a> (<a class="idref" href="PE.html#pe_block"><span class="id" title="definition">pe_block</span></a> <span class="id" title="var">pe_st</span>) (<a class="idref" href="PE.html#p:451"><span class="id" title="variable">p</span></a> <span class="id" title="var">l</span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="keyword">end</span>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Inductive</span> <a id="pe_peval" class="idref" href="#pe_peval"><span class="id" title="inductive">pe_peval</span></a> {<a id="L:454" class="idref" href="#L:454"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>} (<a id="p:455" class="idref" href="#p:455"><span class="id" title="binder">p</span></a> : <a class="idref" href="PE.html#program"><span class="id" title="definition">program</span></a> <a class="idref" href="PE.html#L:454"><span class="id" title="variable">L</span></a>)<br/>
&nbsp;&nbsp;(<a id="st:456" class="idref" href="#st:456"><span class="id" title="binder">st</span></a>:<span class="id" title="definition">state</span>) (<a id="pe_st:457" class="idref" href="#pe_st:457"><span class="id" title="binder">pe_st</span></a>:<a class="idref" href="PE.html#pe_state"><span class="id" title="definition">pe_state</span></a>) (<a id="l:458" class="idref" href="#l:458"><span class="id" title="binder">l</span></a>:<a class="idref" href="PE.html#L:454"><span class="id" title="variable">L</span></a>) (<a id="st'o:459" class="idref" href="#st'o:459"><span class="id" title="binder">st'o</span></a>:<span class="id" title="definition">state</span>) (<a id="l':460" class="idref" href="#l':460"><span class="id" title="binder">l'</span></a>:<a class="idref" href="PE.html#L:454"><span class="id" title="variable">L</span></a>) : <span class="id" title="keyword">Prop</span> :=<br/>
&nbsp;&nbsp;| <a id="pe_peval_intro" class="idref" href="#pe_peval_intro"><span class="id" title="constructor">pe_peval_intro</span></a> : <span class="id" title="keyword">∀</span> <a id="st':463" class="idref" href="#st':463"><span class="id" title="binder">st'</span></a> <a id="pe_st':464" class="idref" href="#pe_st':464"><span class="id" title="binder">pe_st'</span></a>,<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#peval"><span class="id" title="inductive">peval</span></a> (<a class="idref" href="PE.html#pe_program"><span class="id" title="definition">pe_program</span></a> <a class="idref" href="PE.html#p:455"><span class="id" title="variable">p</span></a>) <a class="idref" href="PE.html#st:456"><span class="id" title="variable">st</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st:457"><span class="id" title="variable">pe_st</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#l:458"><span class="id" title="variable">l</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="PE.html#st':463"><span class="id" title="variable">st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><a class="idref" href="PE.html#pe_st':464"><span class="id" title="variable">pe_st'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <a class="idref" href="PE.html#l':460"><span class="id" title="variable">l'</span></a><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st':463"><span class="id" title="variable">st'</span></a> <a class="idref" href="PE.html#pe_st':464"><span class="id" title="variable">pe_st'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="PE.html#st'o:459"><span class="id" title="variable">st'o</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'-&gt;'_x"><span class="id" title="notation">→</span></a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="idref" href="PE.html#pe_peval:461"><span class="id" title="inductive">pe_peval</span></a> <a class="idref" href="PE.html#p:455"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#st:456"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:457"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#l:458"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#st'o:459"><span class="id" title="variable">st'o</span></a> <a class="idref" href="PE.html#l':460"><span class="id" title="variable">l'</span></a>.<br/><hr class='doublespaceincode'/>
<span class="id" title="keyword">Theorem</span> <a id="pe_program_correct" class="idref" href="#pe_program_correct"><span class="id" title="lemma">pe_program_correct</span></a>:<br/>
&nbsp;&nbsp;<span class="id" title="keyword">∀</span> (<a id="L:465" class="idref" href="#L:465"><span class="id" title="binder">L</span></a>:<span class="id" title="keyword">Type</span>) (<a id="p:466" class="idref" href="#p:466"><span class="id" title="binder">p</span></a> : <a class="idref" href="PE.html#program"><span class="id" title="definition">program</span></a> <a class="idref" href="PE.html#L:465"><span class="id" title="variable">L</span></a>) <a id="st:467" class="idref" href="#st:467"><span class="id" title="binder">st</span></a> <a id="pe_st:468" class="idref" href="#pe_st:468"><span class="id" title="binder">pe_st</span></a> <a id="l:469" class="idref" href="#l:469"><span class="id" title="binder">l</span></a> <a id="st'o:470" class="idref" href="#st'o:470"><span class="id" title="binder">st'o</span></a> <a id="l':471" class="idref" href="#l':471"><span class="id" title="binder">l'</span></a>,<br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#peval"><span class="id" title="inductive">peval</span></a> <a class="idref" href="PE.html#p:466"><span class="id" title="variable">p</span></a> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <a class="idref" href="PE.html#st:467"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:468"><span class="id" title="variable">pe_st</span></a>) <a class="idref" href="PE.html#l:469"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#st'o:470"><span class="id" title="variable">st'o</span></a> <a class="idref" href="PE.html#l':471"><span class="id" title="variable">l'</span></a> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Logic.html#::type_scope:x_'&lt;-&gt;'_x"><span class="id" title="notation">↔</span></a><br/>
&nbsp;&nbsp;<a class="idref" href="PE.html#pe_peval"><span class="id" title="inductive">pe_peval</span></a> <a class="idref" href="PE.html#p:466"><span class="id" title="variable">p</span></a> <a class="idref" href="PE.html#st:467"><span class="id" title="variable">st</span></a> <a class="idref" href="PE.html#pe_st:468"><span class="id" title="variable">pe_st</span></a> <a class="idref" href="PE.html#l:469"><span class="id" title="variable">l</span></a> <a class="idref" href="PE.html#st'o:470"><span class="id" title="variable">st'o</span></a> <a class="idref" href="PE.html#l':471"><span class="id" title="variable">l'</span></a>.<br/>
<span class="id" title="keyword">Proof</span>. <span class="id" title="tactic">intros</span>.<br/>
&nbsp;&nbsp;<span class="id" title="tactic">split</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;<span class="nowrap"><span style='font-size:85%;'><span style='vertical-align:5%;'><span style='letter-spacing:-.2em;'>-</span></span>&gt;</span></span>&nbsp;*)</span> <span class="id" title="tactic">intros</span> <span class="id" title="var">Heval</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#pe_update"><span class="id" title="definition">pe_update</span></a> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">sto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">pe_st</span>. <span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">st</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Heval</span> <span class="id" title="keyword">as</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <span class="id" title="var">sto</span> <span class="id" title="var">l</span> <span class="id" title="var">Hlookup</span> | <span class="id" title="var">sto</span> <span class="id" title="var">l</span> <span class="id" title="var">k</span> <span class="id" title="var">st'o</span> <span class="id" title="var">l'</span> <span class="id" title="var">st''o</span> <span class="id" title="var">l''</span> <span class="id" title="var">Hlookup</span> <span class="id" title="var">Hkeval</span> <span class="id" title="var">Heval</span> ];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">st</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">Heqsto</span>; <span class="id" title="tactic">subst</span> <span class="id" title="var">sto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_None&nbsp;*)</span> <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#pe_peval_intro"><span class="id" title="constructor">pe_peval_intro</span></a>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#E_None"><span class="id" title="constructor">E_None</span></a>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">simpl</span>. <span class="id" title="tactic">rewrite</span> <span class="id" title="var">Hlookup</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_Some&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> (<a class="idref" href="PE.html#keval"><span class="id" title="definition">keval</span></a> <span class="id" title="var">st</span> (<a class="idref" href="PE.html#pe_block"><span class="id" title="definition">pe_block</span></a> <span class="id" title="var">pe_st</span> <span class="id" title="var">k</span>)) <span class="id" title="keyword">as</span> <span class="id" title="var">x</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> <span class="id" title="var">x</span> <span class="id" title="keyword">as</span> [<span class="id" title="var">st'</span> [<span class="id" title="var">pe_st'</span> <span class="id" title="var">l'_</span>] ].<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">symmetry</span> <span class="id" title="keyword">in</span> <span class="id" title="var">Heqx</span>. <span class="id" title="var">erewrite</span> <a class="idref" href="PE.html#pe_block_correct"><span class="id" title="lemma">pe_block_correct</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">Hkeval</span> <span class="id" title="tactic">by</span> <span class="id" title="tactic">apply</span> <span class="id" title="var">Heqx</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Hkeval</span>. <span class="id" title="tactic">subst</span> <span class="id" title="var">st'o</span> <span class="id" title="var">l'_</span>. <span class="id" title="tactic">clear</span> <span class="id" title="var">Hkeval</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">edestruct</span> <span class="id" title="var">IHHeval</span>. <span class="id" title="tactic">reflexivity</span>. <span class="id" title="tactic">subst</span> <span class="id" title="var">st''o</span>. <span class="id" title="tactic">clear</span> <span class="id" title="var">IHHeval</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#pe_peval_intro"><span class="id" title="constructor">pe_peval_intro</span></a>; [| <span class="id" title="tactic">reflexivity</span>]. <span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#E_Some"><span class="id" title="constructor">E_Some</span></a>; <span class="id" title="tactic">eauto</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">simpl</span>. <span class="id" title="tactic">rewrite</span> <span class="id" title="var">Hlookup</span>. <span class="id" title="tactic">reflexivity</span>.<br/>
&nbsp;&nbsp;- <span class="comment">(*&nbsp;&lt;-&nbsp;*)</span> <span class="id" title="tactic">intros</span> [<span class="id" title="var">st'</span> <span class="id" title="var">pe_st'</span> <span class="id" title="var">Heval</span> <span class="id" title="var">Heqst'o</span>].<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">pe_st</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">as</span> <span class="id" title="var">pe_st_l</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">remember</span> <a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">(</span></a><span class="id" title="var">pe_st'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">,</span></a> <span class="id" title="var">l'</span><a class="idref" href="http://coq.inria.fr/library//Coq.Init.Datatypes.html#e6756e10c36f149b18b4a8741ed83079"><span class="id" title="notation">)</span></a> <span class="id" title="keyword">as</span> <span class="id" title="var">pe_st'_l'</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">pe_st</span>. <span class="id" title="tactic">generalize</span> <span class="id" title="tactic">dependent</span> <span class="id" title="var">l</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">induction</span> <span class="id" title="var">Heval</span> <span class="id" title="keyword">as</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <span class="id" title="var">st</span> [<span class="id" title="var">pe_st_</span> <span class="id" title="var">l_</span>] <span class="id" title="var">Hlookup</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id" title="var">st</span> [<span class="id" title="var">pe_st_</span> <span class="id" title="var">l_</span>] <span class="id" title="var">pe_k</span> <span class="id" title="var">st'</span> [<span class="id" title="var">pe_st'_</span> <span class="id" title="var">l'_</span>] <span class="id" title="var">st''</span> [<span class="id" title="var">pe_st''</span> <span class="id" title="var">l''</span>]<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="var">Hlookup</span> <span class="id" title="var">Hkeval</span> <span class="id" title="var">Heval</span> ];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">intros</span> <span class="id" title="var">l</span> <span class="id" title="var">pe_st</span> <span class="id" title="var">Heqpe_st_l</span>;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">inversion</span> <span class="id" title="var">Heqpe_st_l</span>; <span class="id" title="tactic">inversion</span> <span class="id" title="var">Heqpe_st'_l'</span>; <span class="id" title="tactic">repeat</span> <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_None&nbsp;*)</span> <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#E_None"><span class="id" title="constructor">E_None</span></a>. <span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> <span class="id" title="var">Hlookup</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> (<span class="id" title="var">p</span> <span class="id" title="var">l'</span>); [ <span class="id" title="tactic">solve</span> [ <span class="id" title="tactic">inversion</span> <span class="id" title="var">Hlookup</span> ] | <span class="id" title="tactic">reflexivity</span> ].<br/>
&nbsp;&nbsp;&nbsp;&nbsp;+ <span class="comment">(*&nbsp;E_Some&nbsp;*)</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">simpl</span> <span class="id" title="keyword">in</span> <span class="id" title="var">Hlookup</span>. <span class="id" title="var">remember</span> (<span class="id" title="var">p</span> <span class="id" title="var">l</span>) <span class="id" title="keyword">as</span> <span class="id" title="var">k</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">destruct</span> <span class="id" title="var">k</span> <span class="id" title="keyword">as</span> [<span class="id" title="var">k</span>|]; <span class="id" title="tactic">inversion</span> <span class="id" title="var">Hlookup</span>; <span class="id" title="tactic">subst</span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id" title="tactic">eapply</span> <a class="idref" href="PE.html#E_Some"><span class="id" title="constructor">E_Some</span></a>; <span class="id" title="tactic">eauto</span>. <span class="id" title="tactic">apply</span> <a class="idref" href="PE.html#pe_block_correct"><span class="id" title="lemma">pe_block_correct</span></a>. <span class="id" title="tactic">apply</span> <span class="id" title="var">Hkeval</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/><hr class='doublespaceincode'/>
<span class="comment">(*&nbsp;2021-08-11&nbsp;15:11&nbsp;*)</span><br/>
</div>
</div>

<div id="footer">
<hr/><a href="coqindex.html">Index</a><hr/>This page has been generated by <a href="http://coq.inria.fr/">coqdoc</a>
</div>

</div>

</body>
</html>